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
<[EMAIL PROTECTED]> 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
> 
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to