Skip to content

Instantly share code, notes, and snippets.

@johnbeynon
Created October 17, 2012 09:39
Show Gist options
  • Save johnbeynon/3904696 to your computer and use it in GitHub Desktop.
Save johnbeynon/3904696 to your computer and use it in GitHub Desktop.
(select distinct drugs.name
from drugs
where drugs.name NOT IN (select distinct drugs.name from drugs where drugs.customer_id is NOT NULL))
union all
(select distinct drugs.name
from drugs
where drugs.customer_id is NOT NULL)
order by name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment