UserId
|
Name
|
City
|
Education
|
1
|
Suresh
|
Guntur
|
B.Tech
|
2
|
Nagaraju
|
NULL
|
MCA
|
3
|
Sai
|
MBA
| |
4
|
Madhav
|
NULL
|
MBBS
|
Select UserId,Name,City,Education from UserInfo where City <>'NULL'
|
UserId
|
Name
|
City
|
Education
|
1
|
Suresh
|
Guntur
|
B.Tech
|
3
|
Sai
|
MBA
|
We will have to use the IS NULL and IS NOT NULL operators instead.
Select UserId,Name,City,Education from UserInfo where City IS NOT NULL
|
UserId
|
Name
|
City
|
Education
|
1
|
Suresh
|
Guntur
|
B.Tech
|
3
|
Sai
|
MBA
|
Select UserId,Name,City,Education from UserInfo where
City IS NOT NULL AND City <>''
|
UserId
|
Name
|
City
|
Education
|
1
|
Suresh
|
Guntur
|
B.Tech
|
Select UserId,Name,City,Education from UserInfo where
City IS NULL OR City =''
|
UserId
|
Name
|
City
|
Education
|
2
|
Nagaraju
|
NULL
|
MCA
|
3
|
Sai
|
MBA
| |
4
|
Madhav
|
NULL
|
MBBS
|
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|
Subscribe by RSS
Subscribe by Email
5 comments :
nice INFO
i have a table 'size'(Table Name) and in this table fields are size 'compname','branchname','sizename','Qty'
values insert in table-
(cmp001,brc001,si001,'200'
cmp001,brc001,null,400)
i want to get Qty-400 where size is null
(only sigle query according to need both Qty are retrive)
pls
ur website is very good...it's really help me.........
yep yep,, faced this question yestrday in an interview !!
In my table i have null values in multiple column and i want to fetch all records without null values so what will be the query.... Please help me....