select distinct a.*, cma.band, cma.gender, ap.pronoun, gp.id as global_participant_id from ( select * from ( select SPOTIFY_ARTIST_ID, CM_ARTIST, POPULARITY_LATEST, GENRES, ARTIST_NAME, DESCRIPTION from CHARTMETRIC.RAW_DATA.SPOTIFY_ARTIST where NOT (genres is null or genres = '{}') limit 500000 ) UNION select SPOTIFY_ARTIST_ID, CM_ARTIST, POPULARITY_LATEST, GENRES, ARTIST_NAME, DESCRIPTION from CHARTMETRIC.RAW_DATA.SPOTIFY_ARTIST where NOT (genres is null or genres = '{}') AND CM_ARTIST in (486152, 162652, 297120, 210494, 4563, 194905, 1958, 206979, 3748501, 437323, 180047, 71305, 207804, 341882, 567966, 1615300, 182078, 209169, 81807, 912, 3353966, 141609, 572217, 2762, 558681, 5381, 210712, 2581, 260477) ) a inner join facts.prod.global_participant gp on a.spotify_artist_id = gp.spotify_id inner join CHARTMETRIC.RAW_DATA.CM_ARTIST cma on cma.ID = a.CM_ARTIST left join CHARTMETRIC.raw_data.l_cm_artist_pronoun ap on cma.ID = ap.cm_artist WHERE NOT cma.is_duplicate