#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    15
    I've discovered that I can use a comparison operator in a SELECT query (on a number), but I am not sure what the syntax would be if I wanted to use a logical operator *with* a comparison operator.

    This ex works:

    (SELECT * FROM table WHERE numbervariable>5)

    This one fails (0 is not a MySQL Result...) :

    (SELECT * FROM table WHERE numbervariable>5&&<10)

    Anyone see what I'm after, and know a way to get it done?

    - Mike
  2. #2
  3. No Profile Picture
    RyanP
    Guest
    Devshed Newbie (0 - 499 posts)
    i don't believe that SQL supports && or &#0124; &#0124;

    to achieve your example below you could use

    SELECT * FROM table WHERE numbervariable BETWEEN 6 AND 9

    or

    SELECT * FROM table WHERE numbervariable > 5 AND numbervariable < 10

Similar Threads

  1. query syntax error
    By collegebloke in forum MS SQL Development
    Replies: 1
    Last Post: January 19th, 2004, 04:08 PM
  2. Overwriting mysql query with the query results
    By onerandomday in forum PHP Development
    Replies: 1
    Last Post: January 14th, 2004, 04:45 AM
  3. Syntax error in INSERT INTO query
    By Lee Miles in forum Visual Basic Programming
    Replies: 6
    Last Post: December 19th, 2003, 07:37 AM
  4. nested query and MySQL query
    By lucipher in forum MySQL Help
    Replies: 1
    Last Post: November 19th, 2003, 10:49 AM
  5. extremely inconsistent query times
    By mtnman in forum MySQL Help
    Replies: 0
    Last Post: October 23rd, 2003, 12:29 AM

IMN logo majestic logo threadwatch logo seochat tools logo