Hello Friends,
I want to get the information of the record(s) where SmallImage(Field Name) must be unique. For this i'm using the following query. Is it right or not if not plz make it correct
Select * From Gallery1 Where SmallImage in (Select Distinct SmallImage From Gallery1 Where Active=1)
Distinct in SQL Server
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Blocked AccountRank #403 · 6.2K reputationPosted Jan 7, 2008, 12:02 AM EST
Your inner query is working fine and it gives the unique SmallImage. But when outer query fires then it will not give the correct result.
Tell me the total fields u want in the query result.
Happy Coding!!
Manoj Bisht123 reputationPosted Jan 7, 2008, 12:11 AM EST
I've to bring four fields........
ID,SmallImage,BigImage,Address,City
Blocked AccountRank #403 · 6.2K reputationPosted Jan 7, 2008, 12:40 AM EST
Guest UserRank #1,422 · 1.2K reputationPosted Jan 7, 2008, 1:55 PM EST
SmallImage,BigImage,Address,City
FROM
Gallery1