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. Using the LIKE keyword in a query

Using the LIKE keyword in a query

Scheduled Pinned Locked Moved Database
databasealgorithmshelptutorialquestion
4 Posts 2 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.
  • R Offline
    R Offline
    reegan41
    wrote on last edited by
    #1

    Hey, I'm using this database through MS Access with my program and I need to be able to use the LIKE keyword. My forms have specific, formatted field names that are sequential and uniform. Essentially, the first part of every form field name is a part of its subsequential heading. IE. I have a 'heading' column in my table, 'paragraphs'. One example of my headings is 'Scope of Services & Workplan/Methodology Overview'. Now, if I were to use a query searching for that exact name everything works fine. However, I need to use the LIKE clause as follows: SELECT heading FROM paragraphs WHERE heading LIKE 'Scope%' This is because the first part of my form fields are the first words of every heading. ie. Scope_1_chbx, Scope_2_chbx, and so on. My LIKE clause is resulting in the query returning no results....can anyone help me? Thanks. --- reegan41

    K 1 Reply Last reply
    0
    • R reegan41

      Hey, I'm using this database through MS Access with my program and I need to be able to use the LIKE keyword. My forms have specific, formatted field names that are sequential and uniform. Essentially, the first part of every form field name is a part of its subsequential heading. IE. I have a 'heading' column in my table, 'paragraphs'. One example of my headings is 'Scope of Services & Workplan/Methodology Overview'. Now, if I were to use a query searching for that exact name everything works fine. However, I need to use the LIKE clause as follows: SELECT heading FROM paragraphs WHERE heading LIKE 'Scope%' This is because the first part of my form fields are the first words of every heading. ie. Scope_1_chbx, Scope_2_chbx, and so on. My LIKE clause is resulting in the query returning no results....can anyone help me? Thanks. --- reegan41

      K Offline
      K Offline
      Kschuler
      wrote on last edited by
      #2

      Your select statement looks okay to me. Perhaps your data is the problem. I've had problems with the LIKE feature because of selecting LIKE 'ABC%' when my data was in lower case, LIKE 'abc%'. If that is not the case, could you please explain what you are doing further? What do you mean with the Scope_1_chbx, Scope_2_chbx stuff? Could you give us some actual data from the tables? Hope this helps.

      R 1 Reply Last reply
      0
      • K Kschuler

        Your select statement looks okay to me. Perhaps your data is the problem. I've had problems with the LIKE feature because of selecting LIKE 'ABC%' when my data was in lower case, LIKE 'abc%'. If that is not the case, could you please explain what you are doing further? What do you mean with the Scope_1_chbx, Scope_2_chbx stuff? Could you give us some actual data from the tables? Hope this helps.

        R Offline
        R Offline
        reegan41
        wrote on last edited by
        #3

        I actually figured it out...believe it or not, it was because I was using LIKE 'data%' instead of LIKE "data*" For some reason THAT worked instead...odd, but thanks for your help regardless

        K 1 Reply Last reply
        0
        • R reegan41

          I actually figured it out...believe it or not, it was because I was using LIKE 'data%' instead of LIKE "data*" For some reason THAT worked instead...odd, but thanks for your help regardless

          K Offline
          K Offline
          Kschuler
          wrote on last edited by
          #4

          You were using an MS Access database? What version?

          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