Skip to content

Instantly share code, notes, and snippets.

@stevenleeg
Created November 20, 2012 18:39
Show Gist options
  • Save stevenleeg/4120010 to your computer and use it in GitHub Desktop.
Save stevenleeg/4120010 to your computer and use it in GitHub Desktop.
[Musicbrainz] Get albums by artist mbid
SELECT
musicbrainz.release_group.gid AS release_mbid,
musicbrainz.release_group.type AS primary_type,
musicbrainz.release_group_secondary_type_join.secondary_type AS secondary_type,
musicbrainz.release_name.name AS release_name
FROM
musicbrainz.artist
INNER JOIN musicbrainz.artist_credit_name
ON musicbrainz.artist_credit_name.artist = musicbrainz.artist.id
INNER JOIN musicbrainz.artist_credit
ON musicbrainz.artist_credit.id = musicbrainz.artist_credit_name.artist_credit
INNER JOIN musicbrainz.release_group
ON musicbrainz.release_group.artist_credit = musicbrainz.artist_credit.id
INNER JOIN musicbrainz.release_name
ON musicbrainz.release_name.id = musicbrainz.release_group.name
LEFT OUTER JOIN musicbrainz.release_group_secondary_type_join
ON musicbrainz.release_group_secondary_type_join.release_group = musicbrainz.release_group.id
WHERE
musicbrainz.release_group.type = '1' AND
musicbrainz.release_group_secondary_type_join.secondary_type IS NULL AND
musicbrainz.artist.gid = 'a74b1b7f-71a5-4011-9441-d0b5e4122711';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment