okay, let me run through the logic of your query as it is currently written
you want album and artist data for all albums where the album was done by a specific artist OR where there exists a track on the album which was done by the same artist? like in a collection of chrismas hits by various artists?
if i understand this correctly, then you can do it like this --
Code:
(
select tblAlbums.Title as title
, tblAlbums.TitleSort
, tblAlbums.MediaType as format
, tblAlbums.AlbumID as albumid
, tblArtists.The as artist_the
, tblArtists.Artist as artist
, tblArtists.ArtistID as artistid
, tblArtists.SortName as sortname
from tblArtists
inner
join tblAlbums
on tblArtists.ArtistID
= tblAlbums.ArtistID
where tblArtists.Artist like '%Willie Nelson%'
)
union
(
select tblAlbums.Title
, tblAlbums.TitleSort
, tblAlbums.MediaType
, tblAlbums.AlbumID
, tblArtists.The
, tblArtists.Artist
, tblArtists.ArtistID
, tblArtists.SortName
from tblArtists
inner
join tblTracks
on tblAlbums.AlbumID
= tblTracks.AlbumID
where tblTracks.ArtistFullName like '%Willie Nelson%'
)
order
by sortName
, title
, format
note that UNION eliminates duplicates, which i think might come about because the artist's fullname is likely going to also be on all tracks where he's the artist on the album
Bookmarks