Fingerprint
Programmer
Hi All,
I'm working with a database of musical records. There's a table of artists, and another of tracks by that artist. Each track has a genre, where '1' is unclassfied, and anything else is a foreign key to the table of genres.
What I'm trying to do is produce a single html table which has the artist name, the number of unclassified tracks they have, and the number of other tracks by them in the system.
I have put together a query which will count either the unclassified or the classified tracks, but can't work out how to get one query to do both.
I can't change the database structure as this is an existing system. If it's not possible, I just need to know so I can start bodging a work around in asp.
Thanks.
"The secret to creativity is knowing how to hide your sources" - Einstein
I'm working with a database of musical records. There's a table of artists, and another of tracks by that artist. Each track has a genre, where '1' is unclassfied, and anything else is a foreign key to the table of genres.
What I'm trying to do is produce a single html table which has the artist name, the number of unclassified tracks they have, and the number of other tracks by them in the system.
I have put together a query which will count either the unclassified or the classified tracks, but can't work out how to get one query to do both.
Code:
SELECT DISTINCT Artist.name, COUNT (Tracks.trackName) as howmany
FROM Artist, Tracks
WHERE Artist.artistRef = Tracks.artistRef
AND Tracks.genreRef = 1
AND Artist.name LIKE '[A]%'
GROUP BY Artist.name
HAVING COUNT(Tracks.trackName) > 5
ORDER BY COUNT(Tracks.trackName) DESC;
I can't change the database structure as this is an existing system. If it's not possible, I just need to know so I can start bodging a work around in asp.
Thanks.
"The secret to creativity is knowing how to hide your sources" - Einstein