SQL help

John Sims john at conceptualight.com
Fri Feb 25 17:01:48 CST 2011


On 2/25/11 3:50 PM, Steve Albin wrote:
> SELECT TypeGenre.cTypeAbbrev, AlbumTags.nAlbumId, Albums.cTitle, Albums.nAlbumId
> FROM	AlbumTags RIGHT OUTER JOIN TypeGenre ON AlbumTags.typePtr = TypeGenre.RecID
> 	AlbumTags INNER JOIN Albums ON AlbumTags.albumPtr = Albums.RecID
> WHERE Albums.nAlbumId = 1
Untested, but my guess is it needs to be this:

SELECT TypeGenre.cTypeAbbrev, AlbumTags.nAlbumId, Albums.cTitle, Albums.nAlbumId
FROM	AlbumTags RIGHT OUTER JOIN TypeGenre ON AlbumTags.typePtr = TypeGenre.RecID
	INNER JOIN Albums ON AlbumTags.albumPtr = Albums.RecID
WHERE Albums.nAlbumId = 1


The 2nd AlbumTags reference is probably causing the error.  If you line 
your SQL up like this, it is usually easier to see (I hope the 
formatting stays)

SELECT TypeGenre.cTypeAbbrev, AlbumTags.nAlbumId, Albums.cTitle, Albums.nAlbumId
FROM	AlbumTags
RIGHT OUTER JOIN TypeGenre ON AlbumTags.typePtr = TypeGenre.RecID
INNER JOIN Albums ON AlbumTags.albumPtr = Albums.RecID
WHERE Albums.nAlbumId = 1

Hope this helps!

-John


More information about the Valentina mailing list