dcharno wrote:
>> select types.Track,types.URL from ALBUM inner join (select * from MUSIC
>> where Artist_Id =?) types on ALBUM.AlbumId=types.Album_Id order by
>> ALBUM.YomiAlbumName ;
>
> How does the subquery work in this statement? I thought subqueries
> could only retrieve a single column.
No, that's not true. A sub-query is like any other query. I have
rearranged the query to make it more readable.
select types.Track,types.URL
from ALBUM
inner join (select * from MUSIC where Artist_Id =?) as types
on ALBUM.AlbumId=types.Album_Id
order by ALBUM.YomiAlbumName;
In this case the sub-query is returning the subset of the Music table by
the specified artist. This result table is given the name "types", and
it is joined to the album table.
It is often the case the you use a sub-query to select a single result
value (i.e. one row and one column) for use in a comparison, but there
is no restriction on what they can return.
HTH
Dennis Cote
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users