I am trying to create a query that would eliminate records from the second query if they are selected in the first query.
Here is my query:
select *
from activity
where product_code between 'committee/104' and 'committee/199'
and thru_date >= getdate()
and action_codes = 'm'
UNION ALL
select *
from activity
where product_code between 'committee/104' and 'committee/199'
and thru_date >= getdate()
and action_codes = 'a'
order by product_code
In other words, if the first query finds an 'm' action_code for a specific product_code then I want to eliminate them from the second query. Any help would be greatly appreaciated.
Thanks
Here is my query:
select *
from activity
where product_code between 'committee/104' and 'committee/199'
and thru_date >= getdate()
and action_codes = 'm'
UNION ALL
select *
from activity
where product_code between 'committee/104' and 'committee/199'
and thru_date >= getdate()
and action_codes = 'a'
order by product_code
In other words, if the first query finds an 'm' action_code for a specific product_code then I want to eliminate them from the second query. Any help would be greatly appreaciated.
Thanks