SELECT table1.* , table2.Value
FROM table1
INNER JOIN table2
ON table1.id = table2.id
WHERE table2.Label = "Currency"
This is the query. I need to return the values even if
Label = currency
does not exists. i.e., I need to return all rows of table1 with unique id. If table2 has currency then the currency value should be taken else empty value should return.
Try using OUTER JOIN like this:
SELECT table1.* , table2.Value
FROM table1
LEFT JOIN table2
ON table1.id = table2.id
AND table2.Label = "Currency"
0 comments:
Post a Comment