i have not ideal what happen on this.
this is working fine
SELECT
SUM(LAMT)AS SUMAMT,
COUNT(LAMT)AS CNT,
IFNULL(LSUBDT,(CURDATE()-INTERVAL 9999 DAY))AS MXDT
FROM product1
WHERE LSUBBY IN (12,15,17,13,14,16) AND RECST=1 ORDER BY LSUBDT
it return me (which is fineZ)
SUMAMT > 645746.00
CNT > 4
MXDT > 2012-11-14 15:56:56
BUT
when i using MAX(IFNULL(LSUBDT,(CURDATE()-INTERVAL 9999 DAY)))AS MXDT
it return me
MXDT > 323031322d31312d32332030353a30323a3037
WHY? i cant use it to do compare in php when using strtotime
1). what’s wrong with the sql MAX()?
2). Any alternative beside MAX()? i want get the latest DATETIME.
3). can some where some how php CONVERT it back to 2012-11-14 15:56:56 format then i continue in php compare later
By the way
4). the return result of MXDT > 2012-11-14 15:56:56 also is not correct coz in the database the latest datetime is 2012-11-24 5:36:25, if i remove the sum and the count then it return me correctly.
thanks
Try this: