mysql select checking for null characters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tolkienarda
    Contributor
    • Dec 2006
    • 316

    mysql select checking for null characters

    hi all
    i dynamicaly generate a select statement and there seems to be a problem with it.
    below is an example of one that is generated
    Code:
    SELECT TITLE, FNMI, SALUTATION, COMPANY, E_MAIL FROM DBASE WHERE BOARD IS NOT NULL, OR CBM IS NOT NULL, OR LEGIS IS NOT NULL
    when i paste it into the sql part of phpmyadmin i get the following error
    Code:
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' OR CBM IS NOT NULL , OR LEGIS IS NOT NULL  LIMIT 0, 30' at line 1
    all of the capital letters are because someone made this database in microsoft access, and she apparently likes caps. I have never used 'OR' or IS NOT NULL in my select statements before and maybe there is somthing wrong with that syntax

    i would love some help

    eric
  • ScarletPimpernal
    New Member
    • Mar 2007
    • 39

    #2
    Hi,

    The Syntax for the query is wrong:

    Use the Below query,

    SELECT TITLE, FNMI, SALUTATION, COMPANY, E_MAIL FROM DBASE WHERE BOARD IS NOT NULL OR CBM IS NOT NULL OR LEGIS IS NOT NULL;

    There can't be Comma seperator in the query, i mean in the where clause of the query.

    Thanks,
    Scarlet




    Originally posted by tolkienarda
    hi all
    i dynamicaly generate a select statement and there seems to be a problem with it.
    below is an example of one that is generated
    Code:
    SELECT TITLE, FNMI, SALUTATION, COMPANY, E_MAIL FROM DBASE WHERE BOARD IS NOT NULL, OR CBM IS NOT NULL, OR LEGIS IS NOT NULL
    when i paste it into the sql part of phpmyadmin i get the following error
    Code:
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' OR CBM IS NOT NULL , OR LEGIS IS NOT NULL  LIMIT 0, 30' at line 1
    all of the capital letters are because someone made this database in microsoft access, and she apparently likes caps. I have never used 'OR' or IS NOT NULL in my select statements before and maybe there is somthing wrong with that syntax

    i would love some help

    eric

    Comment

    • tolkienarda
      Contributor
      • Dec 2006
      • 316

      #3
      perfect thanks a million

      eric

      Comment

      Working...