I HAVE TABLE LIKE
SNO NAME MOBILE
1 SHAS 9346353452
2 RAJU NULL
3 VAMSHI 0
4 PRAVEEN 9765432111
I WANT SELECT ONLY WITHOUT NULL AND 0 VALUES IN SQL MOBILE COLOUM
O/P LIKE
SNO NAME MOBILE
1 SHAS 9346353452
4 PRAVEEN 9765432111

Ranjit PowarRank #553 · 4.4K reputationPosted Apr 22, 2014, 9:25 AM EDT
If datatype of Mobile column is decimal or int
Select Mobile from TableName
Where Mobile !=0
If datatype of Mobile column is Varchar
Select Mobile from TableName
Where Mobile !='0'
VulpesRank #55 · 29.2K reputationPosted Apr 22, 2014, 9:45 AM EDT
If datatype of Mobile column is decimal or int:
Select Mobile from TableName
Where Mobile Is Not Null And Mobile != 0
If datatype of Mobile column is Varchar:
Select Mobile from TableName
Where Mobile Is Not Null And Mobile != '0'
Jignesh TrivediRank #16 · 50.3K reputationPosted Apr 22, 2014, 8:06 PM EDT
you can also try...
Select Mobile from TableName
Where isnull(Mobile,'0') != '0'
hope this will help you.