Question with SQL syntax - LIKE predicate

Results 1 to 2 of 2

Thread: Question with SQL syntax - LIKE predicate

  1. #1
    Vega Finucan Guest

    Default Question with SQL syntax - LIKE predicate

    I am using a series of drop down lists on a search page which the user selects to derive the content of the following drop down list (making the scope more narrow). Once the user is satisfied with the contents of a drop down, he/she initiates the search. As I have only one field to work with wihtin the database, I have created a naming convention that consists of dashes and astericks. I am trying to use the like predicate to both include and exclude values. I can derive the contents of the drop down list with the following syntax "SELECT * from tbldept WHERE dept LIKE &#039" & SEL & "%&#039" and it also works with the following syntax: "SELECT * from tbldept WHERE dept NOT LIKE &#039%-%-%&#039"; But, I cannot get any values when I write it this way: "SELECT * from tbldept WHERE dept LIKE &#039" & SEL & "%&#039 AND NOT LIKE &#039%-%-%&#039"; Do you have any ideas? Thanks.

  2. #2
    Vega Finucan Guest

    Default RE: Question with SQL syntax - LIKE predicate

    I figured it out. Dumb mistake...I was missing a dept in the syntax.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •