Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query help, please...

Status
Not open for further replies.

admoore

IS-IT--Management
May 17, 2002
224
US
I have a query selecting records where one enumerative field must be !='N' and any one of six others must be
!='N' like:
Code:
$sql_text = ("SELECT * FROM orders  WHERE invoiced != 'Y'
         AND  (
                data_status    != 'N' OR
                art_status     != 'N' OR
                laser_status   != 'N' OR
                print_status   != 'N' OR
                insert_status  != 'N' OR
                mail_status    != 'N' OR
              )
              ORDER BY to_mail_date ASC");
I obviously have something wrong here and am looking for some help on whatever it is I am doing wrong.

TIA for any help,

-Allen
 
I am assuming that the "enumerative field" is the field named "invoiced".

Your question states that the "enumerative field" must be not equal to "N".

Why, then, does your select query require that the field be not equal to "Y"?



Want the best answers? Ask the best questions: TANSTAAFL!!
 
Sorry; the code is correct, typo in post, should be
one enumerative field must be !='N'

Get error upon execution.

-adm
 
>>> What error?


via php:
Warning: Supplied argument is not a valid MySQL result resource

or via MySQL command line:
ERROR 1064: You have an error in your SQL syntax near '("SELECT * FROM orders WHERE invoiced != 'Y'
AND (
da' at line 1
-adm
 
You have an error in your SQL syntax near '("SELECT ...

i'm thinking it doesn't like the parentheses

rudy
SQL Consulting
 
Seems to have been:

a spurious character between "da" and "ta_status"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top