15 October 2010

Might come in handy again

The table amgp_release associates UPC codes (amgp_upc) with album IDs (amgp_a_id). You'd think that this would be a one-to-one relationship, but apparently multiple IDs can share the same UPC code. Question: What are the UPCs that are associated with multiple IDs? Query:



select count(*), amgp_upc
from (select distinct amgp_upc, amgp_a_id from amg.amgp_release) tbl
group by amgp_upc
having count(*) > 1

No comments: