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. Database & SysAdmin
  3. Database
  4. Querying with an empty field.

Querying with an empty field.

Scheduled Pinned Locked Moved Database
databasehelptutorialquestionworkspace
2 Posts 1 Posters 1 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
    Chris Klecker
    wrote on last edited by
    #1

    I have a database set up where some columns might have no data entered like in the following example record [Column1Data : Column2Data] record [Column1Data : Column2Data : Column3Data] I would like to differenciate between the two records by querying the first record that has no data for column3. I figured on trying SELECT * FROM TABLE1 WHERE Column1 LIKE 'Column1Data' AND Column2 LIKE 'Column2Data' AND Column3 LIKE ('') but this returned no records. Is something like this possible or might this be an issue of database setup? :confused: Thanks!

    C 1 Reply Last reply
    0
    • C Chris Klecker

      I have a database set up where some columns might have no data entered like in the following example record [Column1Data : Column2Data] record [Column1Data : Column2Data : Column3Data] I would like to differenciate between the two records by querying the first record that has no data for column3. I figured on trying SELECT * FROM TABLE1 WHERE Column1 LIKE 'Column1Data' AND Column2 LIKE 'Column2Data' AND Column3 LIKE ('') but this returned no records. Is something like this possible or might this be an issue of database setup? :confused: Thanks!

      C Offline
      C Offline
      Chris Klecker
      wrote on last edited by
      #2

      Nevermind! Found the solution I believe. for those with curiousity... Is Null for empty fields Is Not Null for not empty fields So for example SELECT * FROM TABLE WHERE COLUMN1 LIKE 'DATA1' AND COLUMN2 Is Null This will return all records where column1 is DATA1 and column2 is blank. "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."

      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