Re: Totaling sales by month
| From: | Andrew Kreps | Date: | Sat, 11 Sep 2004 00:19:10 +0000 |
| Subject: | Re: Totaling sales by month | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-196377@lists.php.net to get a copy of this message | ||
This one worked for me, on MySQL 3.23.xx. I hope it's closer to what you need.
select sum(ordersubtotal), date_format(orderdate, '%Y-%m') as odate
from orders group by odate
On Fri, 10 Sep 2004 15:01:34 -0700, Brian Dunning
<brian@briandunning.com> wrote:
> I have a MySQL db with a datetime field containing the date and time of
> the sale. I want to query for a simple report that shows total sales by
> month.
>
> I thought this would be quick & easy but it's NOT! I can't figure out
> how to query for it.
>
> If this question would be better posed to a SQL list, I'd appreciate a
> recommendation to a good one. I couldn't find one via STFW that had any
> kind of volume.
>
> - Brian
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>