7
Answers

Remove duplicate recoed with exclude one column

Photo of Bhavesh Jadav

Bhavesh Jadav

6y
578
1
Hello friends,
 
I have a query like:
  1. select '1101' as Id, 'prd1' as Name, '1' as DisplayOrder  
  2. union ALL  
  3. select '1102' as Id, 'prd2' as Name,'2' as DisplayOrder  
  4. union ALL  
  5. select '1103' as Id, 'prd3' as Name, '3' as DisplayOrder  
  6. union ALL  
  7. select '1102' as Id, 'prd2' as Name, '4' as DisplayOrder 
 And it's output:
 
 
But I want output like: 
 
 or
 
 
What should I do?
How can I get above output using SQL query or from c# code?

Thanks. 
 

Answers (7)