pigmentarts
asked on
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
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
yes, but note chapmandew did the hard work...
ASKER
thanks both of you
ASKER