Re: SQL syntax

Amit Tandon <[email protected]>
Newsgroups gmane.comp.php.database
Message-ID <CAM5Pkjf+iUJ2V6hyBLXRvEGtb7UeO=CA_327q_OCX1tpd3egAw@mail.gmail.com>
SELECT orderid
                FROM ORDERS_TABLE
                WHERE orderstatus IN ( 'Cancelled', 'New'", 'Denied',
'Expired' , 'Failed' , 'Pending' , 'Refunded' , 'Reversed' , 'Under Review'
, 'Voided') AND orderdate < '".mysqli_real_escape_string($
yesterday);

Another option would be to use either  of these functions

   - Find-in-set<http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_find-in-set>.
   This is useful if your data type is SET/ENUM type
   - Field<http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_field>


On Tue, Jan 15, 2013 at 2:59 PM, Karl DeSaulniers <[email protected]>wrote:

> SELECT orderid
>                 FROM ORDERS_TABLE
>                 WHERE orderstatus = 'Cancelled' OR (orderstatus = ('New'
> OR 'Denied' OR 'Expired' OR 'Failed' OR 'Pending' OR 'Refunded' OR
> 'Reversed' OR 'Under Review' OR 'Voided') AND orderdate <
> '".mysqli_real_escape_string($**yesterday)."')";
>



============
regds
amit

"The difference between fiction and reality? Fiction has to make sense."
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.