[Solved] How can I select 4 distinct values from 2 tables containing many rows of data in SQL Server?


Something like this?

SELECT TOP 4 
    g.GalleryID
    ,g.GalleryTitle
    ,g.GalleryDate
    ,MAX(m.MediaThumb) AS MaxMediaThumb
FROM Galleries g
    INNER JOIN Media m
        ON g.GalleryID = m.GalleryID
GROUP BY g.GalleryID, g.GalleryTitle, g.GalleryDate

3

solved How can I select 4 distinct values from 2 tables containing many rows of data in SQL Server?