Created
December 18, 2015 12:30
-
-
Save ysinc88/363eb0f39810a3afd5bd to your computer and use it in GitHub Desktop.
tsql concat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
r.name as release,a.name as artist,r.version,l.name as label,count(distinct r.upc) as upcCount,concat(distinct r.upc) as upcs | |
from releases r | |
join artists a on a.artistid = r.artistid | |
join labels l on l.labelid = r.labelid | |
where l.name = 'foo' | |
group by r.name, a.name,l.name,r.version,upcs | |
having count(distinct r.upc) > 1 | |
order by upcCount desc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment