Is there a better way to write
Select distinct id_no
from revenue_table
where (exists (select * from revenue_table i
where revenue_type = 'Shipping' and i.id_no = r.id_no)
and exists(select * from revenue_table i
where revenue_type = 'Reproduction' and i.id_no = r.id_no)
and exists(select * from revenue_table i
where revenue_type = 'Tape' and i.id_no = r.id_no))
id_no represents a form, which is entered into the table once for each revenue item on the form. Same revenue_type’s can appear multiple times. There are many advanced functions that work using OR logic but I cannot seem to find any functions using AND set theory. It would be really nice if GROUP BY had some function to compare a group such as id_no to a set like (Shipping, Reproduction, Tape)
Does this exist?
Another option would be
You’ll have to test whether or not it is an improvement.