id img_name img cat_id sub_id 1 blue ../UploadedImage/download (1).jpg 1 2 2 rose ../UploadedImage/images (3).jpg 1 1 5 kola ../UploadedImage/6pl.jpg 2 3 6 rat ../UploadedImage/Hydrangeas.jpg 2 4 7 animal ../UploadedImage/0z8.jpg 1 5 9 fdd ../UploadedImage/images (2).jpg 1 1 10 guys ../UploadedImage/Desert.jpg 2 3 11 ddfdf ../UploadedImage/download.jpg 1 1 12 ddfdfdfd ../UploadedImage/images (1).jpg 1 1
img_name cat_id sub_id blue ../UploadedImage/download (1).jpg 1 2 rose ../UploadedImage/images (3).jpg 1 1 1 ddfdf ../UploadedImage/download.jpg 1 1 1 ddfdfdfd ../UploadedImage/images (1).jpg 1 1
SELECT Image_id, sub_id, Image_path FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY sub_id ORDER By Image_Id ) AS rn FROM MyTable) x WHERE rn = 1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)