Boy, that was easy. I just figured it out after sending the question: mysql> SELECT period,hours FROM log GROUP BY MONTH(period);
-----Original Message----- From: Forer, Leif Sent: Tuesday, February 26, 2002 5:32 PM To: '[EMAIL PROTECTED]' Subject: group by month There is a date column in a table and I want to select data from the table by month (instead of by every single entry within each month). Here's a sample of the table: mysql> SELECT period,hours FROM log GROUP BY period; +------------+-------+ | period | hours | +------------+-------+ | 1999-07-15 | 73.1 | | 1999-07-31 | 82.0 | | 1999-08-15 | 36.5 | | 1999-08-31 | 78.5 | | 1999-09-15 | 55.0 | | 1999-09-30 | 52.5 | | 1999-10-15 | 56.0 | | 1999-10-31 | 61.0 | | 1999-11-15 | 7.5 | | 1999-11-30 | 26.0 | | 1999-12-15 | 17.5 | | 1999-12-31 | -12.5 | +------------+-------+ 12 rows in set (0.00 sec) I would love to do something like select period and hours from table and group by month. Is there a MySQL function to help with this? ~Leif ************************************************************************** This e-mail and any files transmitted with it may contain privileged or confidential information. It is solely for use by the individual for whom it is intended, even if addressed incorrectly. If you received this e-mail in error, please notify the sender; do not disclose, copy, distribute, or take any action in reliance on the contents of this information; and delete it from your system. Any other use of this e-mail is prohibited. Thank you for your compliance. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php