I’ve got two tables, and I want to compare the data between them, and pick out the data from one table which is not present in the other. I already have a code that works in SQL Server Management, but I need to convert it into Rails or I need to be able to use raw SQL code in my code. Here is the code:
select * from app_servers
where not exists
( select app, environment, server
from stagings
where stagings.server = app_servers.server_id
AND
stagings.environment = app_servers.environment_id
AND
app_servers.app_id = stagings.app
)
Thanks in advance
Why do you want to convert it? You might use it as it is