Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. sql query

sql query

Scheduled Pinned Locked Moved ASP.NET
databasecsharptutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    C Coudou
    wrote on last edited by
    #1

    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 aab

    C# コードMicrosoft End User 2000-2008 「「「「「「「「「「「「「「「「「「「「「「「「「「「「 The best things in life are free 」」」」」」」」」」」」」」」」」」」」」」」」」」」」

    S 1 Reply Last reply
    0
    • C C Coudou

      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 aab

      C# コードMicrosoft End User 2000-2008 「「「「「「「「「「「「「「「「「「「「「「「「「「「「 The best things in life are free 」」」」」」」」」」」」」」」」」」」」」」」」」」」」

      S Offline
      S Offline
      s_magus
      wrote on last edited by
      #2

      Select Top 1 Code From tblCode Where Code > @Code And CodeName Is Null Order By Code @Code = input from first text box

      C 1 Reply Last reply
      0
      • S s_magus

        Select Top 1 Code From tblCode Where Code > @Code And CodeName Is Null Order By Code @Code = input from first text box

        C Offline
        C Offline
        C Coudou
        wrote on last edited by
        #3

        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 」」」」」」」」」」」」」」」」」」」」」」」」」」」」

        B 1 Reply Last reply
        0
        • C C Coudou

          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 」」」」」」」」」」」」」」」」」」」」」」」」」」」」

          B Offline
          B Offline
          Brij
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups