I want to create a select query that checks for a certain value (example below: ‘green’) in table 1, if exists, it finds the same id in table 2 and displays that rows data.
table 1
id car
1 black
2 green
table 2
id status
1 old
2 broken
So the result should be: ‘broken’.
Heres my code:
SELECT TOP 100 car CASE WHEN table1.car IN ('green') THEN Table2.status END AS 'result'
FROM Table1.ID INNER JOIN Table2.ID
1 Answer