Re: SQL syntax
| From: | Amit Tandon | Date: | Tue, 15 Jan 2013 11:25:52 +0000 |
| Subject: | Re: SQL syntax | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-48641@lists.php.net to get a copy of this message | ||
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 <karl@designdrumm.com>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."