Return only unique id's that are not associated with value

From: Dimitri <a(dot)dmitri(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Return only unique id's that are not associated with value
Date: 2011-03-19 04:15:02
Message-ID: AANLkTi=UCGDeVpSJSF+_HiVjeSWDdJaBQz9YMGMOMxq5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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.

report_filters
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.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Dimitri 2011-03-19 04:55:32 ERROR: synatx error at or near "group"
Previous Message Joshua Tolley 2011-03-18 20:31:31 Re: Accessing dead rows within postgresql