Ajay Mavatkar

Ajay Mavatkar

  • NA
  • 68
  • 12.4k

query for filtering based on condition

May 31 2017 3:48 AM
Hi, 
 
I have data following like this
 






Col1 Col2 Col3 Col4 Col5 Col7
1 19 test1 NY F NULL
1 19 test1 NY F NULL
2 87 test2 NY F 9999778876
3 92 test3 NY F 7766887765
4 70 test4 NY M NULL
4 70 test4 NY M 3344556765
5 22 test5 HI M 8899775544
 
 I want to display distinct data 
For eg Col1 has some multiple records and I need to display any one record when Col7 is null.
If Col7 is not null then I have to display  record in which col7 is not null as follows
 
Col1 Col2 Col3 Col4 Col5 Col7
1 19 test1 NY F NULL
2 87 test2 NY F 9999778876
3 92 test3 NY F 7766887765
4 70 test4 NY M 3344556765
5 22 test5 HI M 8899775544
 
How to achieve this query 
 
 
 
 

Answers (3)