Re: Group by Month
Hello. Please, provide more information about your data structure and what would you want to get from the query. These manual pages might be helpful: http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html http://dev.mysql.com/doc/mysql/en/group-by-functions.html Jerry Swanson <[EMAIL PROTECTED]> wrote: > I have query that pulls data between to dates. How to group the data by mon= > th? > -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Group by Month
group by date_format(field_type_date,'%Y/%m' ) -Original Message- From: Jerry Swanson [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 20, 2005 1:08 PM To: mysql@lists.mysql.com Subject: Group by Month I have query that pulls data between to dates. How to group the data by month? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Group by Month
[snip] I have query that pulls data between to dates. How to group the data by month? [/snip] It would be better if you showed use the query, but heh...our mind reading skills are getting pretty good. At the end of your query put the line; GROUP BY month -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: group by month
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