I have 2 tables ID and Comm. The tables are as follows
ID AppID Name 1 James 2 John . . 100 Jeff Comm AppID Comment 1 abc 1 def 1 pqr 2 abc 2 def 2 pqr 3 def
I want all appID from ID (First table) and from Comm(Second table) I want only those comment which are equal to abc, rest others should be NULL.
I am using following query, not sure how do I filter comment abc and Null
select id.appid,comm.comment
from id left join comm on
id.appid=comm.appid
where comm.comment = 'abc'
I know I have the logic wrong, trying to figure out where should I change. Any help is appreciated.
select id.appid,comm.comment
from id
left join comm
on id.appid=comm.appid
and comm.comment = 'abc'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With