SQL query to get members of a group

postgresql
query
Tags: #<Tag:0x00007f98ce6919a0> #<Tag:0x00007f98ce691860>

#1

Hi,

I am trying to get just the members of a group using an SQL query. I managed to link via the foreign keys entity0 and entity1 of l_artist_artist, however I am getting all relationships. How can I get just the band members pls?

SELECT a.name,c.name from l_artist_artist
JOIN artist a ON l_artist_artist.entity0=a.id
JOIN artist c ON l_artist_artist.entity1=c.id
where c.name = ‘The Beatles’


#2

You need to look for the specific member relationship: https://musicbrainz.org/relationship/5be4c609-9afa-4ea0-910b-12ffb71e3821

So, link_type GUID 5be4c609-9afa-4ea0-910b-12ffb71e3821 or ID 103 :slight_smile: