Re: SQL syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Jan 15, 2013, at 5:25 AM, Amit Tandon wrote:

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@xxxxxxxxxxxxxxx >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."


I am wanting Cancelled to be without a date check, but thanks for the suggestion.
I will try the IN option.

Thank you.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux