ShawnMolloy
MIS
Hello,
I have two tables.
Image_Album
album_Id int
Images
album_Id int
I want to get a query that returns all the Image Albums, and a column with the count of row that have the album_id in the images table. What is the best way to acomplish that?
Here is my current query; whcih doesn't work :S
SELECT A.AlbumDescA.,DateCreated,A.UserId,A.IsPrivate,A.CoverImgSrc,A.AlbumName,
(SELECT count(*) from image B where B.AlbumId = A.AlbumId) ImageCount
FROM Image_Album
WHERE USERID=@userid
Any help would be greatly appricated!
Thanks,
-- shawn
I have two tables.
Image_Album
album_Id int
Images
album_Id int
I want to get a query that returns all the Image Albums, and a column with the count of row that have the album_id in the images table. What is the best way to acomplish that?
Here is my current query; whcih doesn't work :S
SELECT A.AlbumDescA.,DateCreated,A.UserId,A.IsPrivate,A.CoverImgSrc,A.AlbumName,
(SELECT count(*) from image B where B.AlbumId = A.AlbumId) ImageCount
FROM Image_Album
WHERE USERID=@userid
Any help would be greatly appricated!
Thanks,
-- shawn