Click here to Skip to main content
15,892,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i have select query return duplicate value
i try use selec distinct column1,column2,.... from table
but there is an error

the ntext data type cannot be selected as distinct.

how can prevent duplicate on speciefic column such as id
Posted

Try casting column1 to a varchar

select distinct cast(column1 as varchar(max)), column2...
 
Share this answer
 
Comments
Аslam Iqbal 17-Mar-11 8:10am    
pure solution
Pravin Patil, Mumbai 17-Mar-11 8:12am    
My 5...
fjdiewornncalwe 17-Mar-11 9:44am    
It's almost amusing that the OP even has the terminology correct and wasn't bothered to check the web. "SQL distinct" returned 1.6 million results with the entire first page consisting of tutorials on how to implement it.
Try this

select distinct (col1,col2) from tablename


go through the below link
Here[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900