hi.

your table looks something like this:

table1
-----
date    (date)
order_number int(6)

...i wasn't sure if "order_number" is referring to a "order" table
somewhere...
if there are multiple rows for each day, and you want to add up
"order_number" for each day, use:

  select
        DAYOFMONTH(date) as d,
        SUM(order_number)
  from
        table1
  group by d

if you want to count the rows per day (which i think is what you're after),
use:

  select
        DAYOFMONTH(date) as d,
        count(order_number)
  from
        table1
  group by d

you probably want to add in a where clause

  where MONTH(date) = 4

to limit the rows to all days in april, for example.

hth.
-ravi.

-----Original Message-----
From: Graham Nichols [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 01, 2001 11:23 AM
To: [EMAIL PROTECTED]
Subject: Newbie group/count query question


I have a table which contains a date column and an order_number column. I
need to formulate a query syntax to return the total number of orders for
each day in a given month (if any). Can someone help me with the syntax
please as I've been stumbling around with it all day without success.

Many thanks,   Graham



---------------------------------------------------------------------
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



---------------------------------------------------------------------
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

Reply via email to