January 23, 2005 at 5:07 pm
The following currently displays
all 365 days and the number of
orders placed each day.
How can I modify this code to get a yearly
summary that would display "we average 90
order on Monday, 26 on Tuesday, etc" OR what
is the SQL code to create a table with two columns,
DayName (i.e. Monday) and Date (i.e. 20040101) so
I can then LINK the "date" and "order-header"
tables together to get the results ?
SELECT entrydate, COUNT(orderno) AS Number
FROM [order-header]
WHERE (SUBSTRING(source, 1, 8) = '223WHOLE')
GROUP BY entrydate
HAVING (entrydate BETWEEN '20040101' AND '20041231')
ORDER BY entrydate
January 23, 2005 at 7:01 pm
Select datename (dw, Entrydate) as 'Day of week' , count(OrderNo) as Number
From [order-header]
Where (SUBSTRING(source, 1, 8) = '223WHOLE')
and EntryDate bewtween '20040101' AND '20041231'
GROUP BYdatename (dw, Entrydate)
January 23, 2005 at 7:18 pm
Thanks for the GREAT help.
The script was PERFECT.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply