I am trying to run the below query. for a reason i need to join different tables which includes the results from all tables.
Let's say the query is :
Select a.value1, b.value2, c.value3
from a
join b on a.some_value = b.some_value1
join c on c.Some_other_value = b.some_diff_value
where (my conditions)...
Let's say the result of the above query is :
value1 | value2 | value3
-------+--------+--------
1 | val1 | val2
1 | some1 | some2
2 | othr1 | othr2
3 | diff2 | diff3
I want to remove the values from the above result set which value1 is not 1.
Expected output:
value1 | value2 | value3
-------+--------+--------
1 | val1 | val2
1 | some1 | some2
Is there any way in postgresql that I can achieve this? Searched for different threads but no clue in any other posts. Any suggestions are appreciated.
Note: I cannot use where a.value1 = 1
as the logic in the SQL query will result in losing some records for doing math. So the whole idea is to run the SQL query as is but to remove the records after the Select operation is done and just have the result with value1 = 1
.