I am new to SQL and I would like to get some insights for my problem I am using the following query,
select id,
pid
from assoc
where id in (100422, 100414, 100421, 100419, 100423)
All these id need not have pid, some doesn't and some has pid. Currently it skips the records which doesn't have pid. I would like a way which would show the results as below.
pid id
-----------
703 100422
313 100414
465 100421
null 100419
null 100423
Any help would be greatly appreciated. Thanks!
pid(there's no filter on the field). Tryselect id, pid from assoc where pid is nullorselect id, pid from assoc where pid is null and id = 100423to examine the records withnullpid. Do you have, say,null 100423recordnullpidat all? Doesselect id, pid from assoc where pid is nullreturns anything but an empty cursor?union allwhich returns those not existing. Do you have another different 'master id' table which contains all id's, including those without a pid?