Keith Tate (2/5/2014)
First please read the article in my signature about posting these types of questions to the forum. After you do that I could make sure that the answer is correct. Without the necessary information the following where statement should get you what you want:where type not in ('aa', 'cc')
and type <> = 'g2'
and code = 3
and (table2.start_date is null
or table2.end_date is null
or table2.program_id is null)
Instead of all of the nulls you could use union all for each of the "is null" statements.
Just a curiosity... why did you treat 'g2' separately instead of just using...
WHERE [Type] NOT IN ('aa','cc','g2')
--Jeff Moden
Change is inevitable... Change for the better is not.