I was using this query and getting queer results:
SELECT MemberID, Surname, Houshold, Houmuch, CASE WHEN Houmuch < (SELECT sharePrice
FROM Stock) THEN ADDDATE(ereStart, (Houmuch * (SELECT hwyl FROM Stock)) / (SELECT
regularPayment FROM Stock)) ELSE TIMESTAMPADD(YEAR, 2, CURDATE()) END AS goodThrough, ...
FROM EachName NATURAL JOIN (SELECT MemberID, SUM(Amount) AS Houmuch
FROM GiftandShare
WHERE Why = 2 AND Date <= '2011/11/13'
GROUP BY MemberID) AS Paid NATURAL JOIN Address
HAVING goodThrough >= '2011/11/13'
ORDER BY Surname
I looked at the date-comparisons and wondered how they were done: when I changed the
slashes to hyphens it properly worked!
I think it would be better if MySQL had real timestamp-constants--and then the separator
would matter: colon (and semicolon?) for the sexagesimal part and anything else for the
day part.
| Thread |
|---|
| • string comparison for timestamp! | hsv | 30 Oct |