# get count

based on the query below, i now need to add to it and get a count of how many is in each day

example
Mon/16 (5)  <---- 5 is the count of how many Mon 16 is in the query
Sat/14 (3)

below produces

Mon/16
Sat/14

SELECT  distinct CONVERT(VARCHAR(10), TIMEDATE , 120) as varDate
FROM orders
WHERE year(TIMEDATE)  = YEAR('#datepassed#')
AND month(TIMEDATE)  = month('#datepassed#')
ORDER BY varDate DESC
LVL 12
###### Who is Participating?

Commented:
SELECT  CONVERT(VARCHAR(10), TIMEDATE , 120) as varDate, count(*)
FROM orders
WHERE year(TIMEDATE)  = YEAR('#datepassed#')
AND month(TIMEDATE)  = month('#datepassed#')
group by CONVERT(VARCHAR(10), TIMEDATE , 120)
0

Author Commented:
what is the variable for count so i can output it?  varDate  (which i need) gives me the date not the count
0

Product SpecialistCommented:
SELECT  CONVERT(VARCHAR(10), TIMEDATE , 120) as varDate, count(*)as countnumber
FROM orders
WHERE year(TIMEDATE)  = YEAR('#datepassed#')
AND month(TIMEDATE)  = month('#datepassed#')
group by CONVERT(VARCHAR(10), TIMEDATE , 120)

I think
0

Author Commented:
ok seems to work with the following is this ok code?

SELECT  CONVERT(VARCHAR(10), TIMEDATE , 120) as varDate, count(order_id) as varCount
FROM orders
WHERE year(TIMEDATE)  = YEAR('#datepassed#')
AND month(TIMEDATE)  = month('#datepassed#')
group by CONVERT(VARCHAR(10), TIMEDATE , 120)
ORDER BY varDate DESC
0

Product SpecialistCommented:
yes, but note chapmandew did the hard work...
0

Author Commented:
thanks both of you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.