MySQL Forums
Forum List  »  Performance

Re: To store or calculate on the spot?
Posted by: Rick James
Date: July 24, 2011 09:14PM

Oops, this was a typo: LEFT(10, datetime, 10)

mysql> SELECT LEFT(NOW(), 10), LEFT(NOW(), 7);
+-----------------+----------------+
| LEFT(NOW(), 10) | LEFT(NOW(), 7) |
+-----------------+----------------+
| 2011-07-24      | 2011-07        |
+-----------------+----------------+
Those are ways to turn a date or a datetime into a day or a month for use in GROUP BY (etc).

Options: ReplyQuote


Subject
Views
Written By
Posted
3318
July 23, 2011 09:15AM
Re: To store or calculate on the spot?
1352
July 24, 2011 09:14PM
1093
August 10, 2011 07:22PM
1154
August 11, 2011 07:52PM
1008
August 12, 2011 07:21PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.