SELECT mm.artist_member_id,au.artist_album_name,mm.line_artist_id,mm.roles_primary FROM musichub_album_upc AS au
LEFT JOIN musichub_artist_group AS mg ON (mg.artist_id = au.artist_id)
LEFT JOIN musichub_artist_member AS mm ON (mm.artist_member_id = mg.artist_member_id)
WHERE au.upc_code = '1111111111'
ข้อมูลที่ได้จากการคิวรี่
Code
artist_member_id,artist_album_name,line_artist_id,roles_primary
3912,Test All Artist,10001,TRUE
10000,Test All Artist,10000,FALSE
SELECT mm.artist_member_id,au.artist_album_name,mm.line_artist_id,mm.roles_primary
FROM musichub_album_upc AS au
LEFT JOIN musichub_artist_group AS mg ON (mg.artist_id = au.artist_id)
LEFT JOIN musichub_artist_member AS mm ON (mm.artist_member_id = mg.artist_member_id)
WHERE au.upc_code = '1111111111'
order by mm.roles_primary limit 1