Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question about T-SQL: grouping data by week
Message
 
 
À
24/03/2002 20:22:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00636665
Message ID:
00636666
Vues:
14
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--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform