Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question about T-SQL: grouping data by week
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00636665
Message ID:
00636666
Views:
13
You can use DATEPART() function
Select Acct, Item, DATEPART(weekday, InvDate) AS dow, SUM(QtyShipped)
FROM mytable 
GROUP BY Acct, Item, DATEPART(weekday, InvDate)
>Hi, all...
>
>I have a file with daily invoice information. I need to be able to
>run a query that groups the data by account, product, and a specific
>day of the week.
>
>My invoice file might read as follows:
>
>Acct C(10)
>Item C(10)
>InvDate SmallDateTime
>QtyShipped Numeric
>
>Suppose I wanted to build a query that would group by acct, item, for
>each week ending Sunday. Is there a specific DATE function I can use
>in a SQL SELECT...GROUP BY so that I can summarize by a specific day
>of the week?
>
>Thanks in advance,
>Kevin
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform