Thread: Return only unique id's that are not associated with value
Hi all, I'm attempting to use two tables and do the following in query:
Return all instances where a unique rpt_id does not contain an fname entry of 'useOnlyMostRecentScan'. This should not return rows that have 'vuln-severity' but only unique rpt_id's that cannot be associated with that value at all. Below are the example tables, any help would be greatly appreciated.
rpt_id fname
951 useOnlyMostRecentScan
951 vuln-severity
932 vuln-severity
952 vuln-severity
952 useOnlyMostRecentScan
950 useOnlyMostRecentScan
reports
rpt_id rpt_name
951 Test1
951 Test1
932 Test2
952 Test3
952 Test3
950 Test4
I thought a WHERE NOT EXISTS and having statement would work but it either returns the whole set or none of it, I'm thoroughly confused at this point.
On Mar 19, 2011, at 9:45 AM, Dimitri wrote: > Return all instances where a unique rpt_id does not contain an fname entry of 'useOnlyMostRecentScan'. This should notreturn rows that have 'vuln-severity' Not able to understand ur requirement. Do you want rpt_id which does not have useOnlyMostRecentScan' and 'vuln-severity' It would be great if you could mention expected result too. Thanks & Regards, Vibhor Kumar EnterpriseDB Corporation The Enterprise PostgreSQL Company vibhor.kumar@enterprisedb.com Blog:http://vibhork.blogspot.com