Click here to Skip to main content
15,878,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got a requirement in some project where i need data from a table where i need to select top values that starts after a null value and than again some null values and further data

suppose table name is Data which has a column named as Company and ID column

ID Company
=== =======
1 NULL
2 NULL
3 Google
4 Microsoft
5 Oracle
6 NULL
7 NULL
8 Linked In
9 FaceBook
10 Twitter
11 NULL
12 NULL

in simple words i need to write a query that selects {Google, Microsoft and Oracle} as a result and nothing else .... its just a sample data not my actual project this data can have hundreds of values between starting null and ending null

Please provide your input to write such query
Thanks
Posted

try this.. :)

SQL
select ColumnName from TableName where ColumnName <> ''
 
Share this answer
 
try below
SQL
select ID,Company from Table1 where Company is not null
 
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