Select only one matching record from each category
Posted on 2009-04-12
Been working with SQL for about a week now, and n00b needs help! =P
I have a table with tons of images, and I am trying to create an ASPX (VB.Net) page that will display only the first image from each category. From here, the user can click on that image to be taken to a "category.aspx" page with all images in that category. Ie...
dbo.IMGS Table Sample:
How would I retrieve *ONLY* the two "IMG1.jpg from Cat1" and "IMG1.jpg from Cat2" from SQL?
SELECT TOP 1 *
WHERE ImgCategory *is different?*
Appreciate any help.