sql query
-
How to sql query the next row of data if has null values? If user will search a code in a textbox, let say 1002, then the result on the second textbox should 1003. let say 1008, then the result on the second textbox should 1009. but if the search code is 1011 then the second textbox has no result. Goal is to get the first NULL values only. TableName:tblCode
Code CodeName
1001 aaa
1002 bbb
1003 NULL
1004 NULL
1005 NULL
1006 NULL
1007 abc
1008 aac
1009 NULL
1010 bba
1011 cca
1012 aabC# コードMicrosoft End User 2000-2008 「「「「「「「「「「「「「「「「「「「「「「「「「「「「 The best things in life are free 」」」」」」」」」」」」」」」」」」」」」」」」」」」」
-
How to sql query the next row of data if has null values? If user will search a code in a textbox, let say 1002, then the result on the second textbox should 1003. let say 1008, then the result on the second textbox should 1009. but if the search code is 1011 then the second textbox has no result. Goal is to get the first NULL values only. TableName:tblCode
Code CodeName
1001 aaa
1002 bbb
1003 NULL
1004 NULL
1005 NULL
1006 NULL
1007 abc
1008 aac
1009 NULL
1010 bba
1011 cca
1012 aabC# コードMicrosoft End User 2000-2008 「「「「「「「「「「「「「「「「「「「「「「「「「「「「 The best things in life are free 」」」」」」」」」」」」」」」」」」」」」」」」」」」」
-
Select Top 1 Code From tblCode Where Code > @Code And CodeName Is Null Order By Code @Code = input from first text box
-
thanks a log s_magus, :) i never think about select top. i always use MAX,MIN. :(
C# コードMicrosoft End User 2000-2008 「「「「「「「「「「「「「「「「「「「「「「「「「「「「 The best things in life are free 」」」」」」」」」」」」」」」」」」」」」」」」」」」」
using Top, we can make a lot good queries.It also got enhanced in SQL 2005. Click here
Cheers!! Brij Visit my Blog: http://brijbhushan.net
My latest Article: Give it a view Exploring Globalization with jQuery