I have two tables one I use to store Album_Name
and other table I use to store Album_Photos
I want to write a query so that it will get me following details
Album_Name Album_ID Album_Date ImageSmall
Album One 1 2013-08-02 100.jpg
Album Two 2 2013-09-09 55.jpg
I want details album details from Album_Name
table and first image which I wasnt to assign to album from Album_Photo
table
I tried JOINS which didn't work for then I create a view will following SQL this doesn't work
SELECT
a.Album_Name AS Album_Name
, a.Album_Date AS Album_Date
, a.Page_ID AS PageID
, p.Image_ID AS Image_ID
, p.Image_Small AS Image_Small
FROM
Album_Name a
LEFT OUTER JOIN
Album_Photos p ON a.Album_ID = p.Album_ID
I tried DISTINCT Album_Name
with view it get me the same row as the above statement
SELECT
DISTINCT [Album_Name], Album_Date, Page_ID, Image_Small
FROM
vw_AlbumName_AlbumPhotos
WHERE
Page_ID = 3
Sample Data Album_Name
& Album_Photos
table
Album_ID Album_Name Album_Date Page_ID
1 Album One 2013-08-02 3
2 Album Two 2013-09-09 3
3 Album Three 2013-09-10 9
Image_ID Page_ID Album_ID ImageSmall
1 0 1 100.jpg
2 0 1 21.jpg
3 0 1 36.jpg
4 0 1 44.jpg
5 0 2 55.jpg
6 0 2 66.jpg
7 0 3 10.jpg
Any help is appreciated.