[thelist] mysql select statement
Anthony Baratta
Anthony at Baratta.com
Sun Apr 29 02:01:45 CDT 2001
At 11:51 PM 4/28/2001, you wrote:
>Hi Gang,
>
>Could an enlightened one please tell me if the OR's in this are valid?
>
>my $dbh=$db->prepare("SELECT docId,docBusName,Email,docContact1,featPending
>FROM tblDockets WHERE docAccountStart=$form{'invoice'} OR
>featExpire=$form{'invoice'} AND docPending <>0 OR featPending<>0");
I think you should "block" '()' your statements in order to help the SQL
interpreter to decipher what it is exactly you are asking.
You could be saying this:
SELECT docId,docBusName,Email,docContact1,featPending
FROM tblDockets
WHERE ( docAccountStart=$form{'invoice'} OR featExpire=$form{'invoice'} )
AND ( docPending <>0 OR featPending<>0 )
OR this
SELECT docId,docBusName,Email,docContact1,featPending
FROM tblDockets
WHERE docAccountStart=$form{'invoice'}
OR ( featExpire=$form{'invoice'} AND docPending <>0 )
OR featPending<>0
Hope this helps, or at least does not hurt.
---
Anthony Baratta
President
Keyboard Jockeys
More information about the thelist
mailing list