lodmark
Member
- Local time
- Today, 20:55
- Joined
- Jul 24, 2020
- Messages
- 250
Hi!
I have a question regarding the appearance of the dropdown list for a search function.
I have collected the fields I need for the search in a question, see image.
Now I just need to make the list distinct so that the appearance in the dropdown list does not contain more than one example of the artist.
I have tested with different SQL statements where I have used DISTINCT and GROUP BY but have not found the right combination.
The selection that gives the list above looks like this:
SELECT DISTINCT
tbl_record.record_ID,
tbl_artist_1.artist_name,
tbl_record.record_release_date
FROM
(
tbl_artist AS tbl_artist_1
INNER JOIN tbl_music ON tbl_artist_1.artist_ID = tbl_music.music_artist_ID
)
INNER JOIN (
tbl_record
INNER JOIN tbl_music_record ON tbl_record.record_ID = tbl_music_record.music_record_record
) ON tbl_music.music_ID = tbl_music_record.music_record_music
ORDER BY
tbl_artist_1.artist_name,
tbl_record.record_release_date;
Anyone think they can find a SQL statement that will give me a list of just one of each artist?
Leif
I have a question regarding the appearance of the dropdown list for a search function.
I have collected the fields I need for the search in a question, see image.
Now I just need to make the list distinct so that the appearance in the dropdown list does not contain more than one example of the artist.
I have tested with different SQL statements where I have used DISTINCT and GROUP BY but have not found the right combination.
The selection that gives the list above looks like this:
SELECT DISTINCT
tbl_record.record_ID,
tbl_artist_1.artist_name,
tbl_record.record_release_date
FROM
(
tbl_artist AS tbl_artist_1
INNER JOIN tbl_music ON tbl_artist_1.artist_ID = tbl_music.music_artist_ID
)
INNER JOIN (
tbl_record
INNER JOIN tbl_music_record ON tbl_record.record_ID = tbl_music_record.music_record_record
) ON tbl_music.music_ID = tbl_music_record.music_record_music
ORDER BY
tbl_artist_1.artist_name,
tbl_record.record_release_date;
Anyone think they can find a SQL statement that will give me a list of just one of each artist?
Leif