# Find all recordings of a set of artists and problem with l\_artist\_recording relation

**URL:** https://community.metabrainz.org/t/find-all-recordings-of-a-set-of-artists-and-problem-with-l-artist-recording-relation/489661
**Category:** Development
**Tags:** musicbrainz, relationships
**Created:** [August 10, 2020, 4:15pm UTC](https://community.metabrainz.org/t/find-all-recordings-of-a-set-of-artists-and-problem-with-l-artist-recording-relation/489661 "2020-08-10T16:15:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![apister](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/a/3d9bf3/32.png) [@apister](https://community.metabrainz.org/u/apister)
#### Post date: [August 10, 2020, 4:15pm UTC](https://community.metabrainz.org/t/find-all-recordings-of-a-set-of-artists-and-problem-with-l-artist-recording-relation/489661/1 "2020-08-10T16:15:43Z")

</div>

Hi all,

I want to extract all recordings of several specific artist. For that I loaded the musicbrainz database on a local postgresql instance using mbdata ([https://github.com/lalinsky/mbdata](https://github.com/lalinsky/mbdata)).

I tried the following command but it did not work :

select artist.name, recording.name from recording, l\_artist\_recording, artist where recording.id=l\_artist\_recording.entity1 AND artist.id=l\_artist\_recording.entity0 and artist.name=‘Nekfeu’;

Indeed, I noticed that the number of rows in the table recordings is different than in l\_artist\_recording. So this mean that we do not have the information of the artist for all recordings right ?

Do someone know why this is the case ? Or maybe I did not understand correctly the database schema ? Do you know how I can answer my question ?

Thank you

---

<div class="post-metadata">

### Author: ![yvanzo](https://community.metabrainz.org/user_avatar/community.metabrainz.org/yvanzo/32/2864_2.png) [@yvanzo](https://community.metabrainz.org/u/yvanzo)
#### Post date: [August 11, 2020, 11:56am UTC](https://community.metabrainz.org/t/find-all-recordings-of-a-set-of-artists-and-problem-with-l-artist-recording-relation/489661/2 "2020-08-11T11:56:44Z")

</div>

> [@apister](#):
>
> all recordings of several specific artist

I assume you want recordings “credited to” several specific artists, you should then use the tables `artist_credit` and `artist_credit_name`, see [database schema](https://musicbrainz.org/doc/MusicBrainz_Database/Schema), instead of `l_artist_recording` which is for [more specific relationship types](https://musicbrainz.org/relationships/artist-recording) only.

For example:

```sql
SELECT recording.name, ac.name
FROM recording
JOIN artist_credit ac ON ac.id = recording.artist_credit
JOIN artist_credit_name acn ON acn.artist_credit = ac.id
JOIN artist ON artist.id = acn.artist
WHERE artist.name = 'Nekfeu'
ORDER BY recording.name, ac.name;

```

---

<div class="post-metadata">

### Author: ![apister](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/a/3d9bf3/32.png) [@apister](https://community.metabrainz.org/u/apister)
#### Post date: [August 11, 2020, 3:54pm UTC](https://community.metabrainz.org/t/find-all-recordings-of-a-set-of-artists-and-problem-with-l-artist-recording-relation/489661/3 "2020-08-11T15:54:45Z")

</div>

Oh ok I had not understood l\_artist\_recording correctly. Your command works thanks !
