Reputation: 2759
I want to make a select query from table A if a different select query returns from table B. Query in table can be select 1 from B where x= something. Query in Table A can be entirely different.
Can i do this in a single SQL query ? What is the best way to achieve this ?
I am using postgres
Upvotes: 0
Views: 314
Reputation: 69769
By the sounds of it you want something like:
SELECT A.SomeColumn, A.AnotherColumn
FROM A
WHERE EXISTS (SELECT 1 FROM B WHERE B.X = Something);
Upvotes: 1