I have 2 tables that Im trying to select 4 results from ordered by GalleryID DESC. The fields Im looking to return are GalleryID, GalleryTitle, GalleryDate from the Galleries table, and MediaThumb from the Media Table.
Now the catch is that the Media table has multiples of 10 of GalleryID's. So, there could be 10 rows in the Media table with the same GalleryID. All I need is one MediaThumb to go along with the galleryid.
Im not sure how to formulate a query to return 4 distinct galleryid's from the galleries table and a MediaThumb from the media table.
Essentially what im trying to do is return 4 unique photo galleries with a cover photo from the media table.
Any help would be appreciated. I provided a snapshot via query designer in sqlserver of my 2 tables.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…