Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Collect information based on a month
Message
 
To
16/11/2008 17:21:47
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01362189
Message ID:
01362191
Views:
10
>What would be a good way to do a SQL query if I have a date field in my table and I want to gather informations based on the months. I mean there could be data in the month of november 2008 but also november 2007.
>
>How can I manage to get the sum for november 2007 and then november 2008 all in the same query?
SELECT YEAR(Date)  AS nYear,;
       MONTH(Date) AS nMonth,;
       SUM(....)   AS SomeTotal;
FROM YourTable;
GROUP BY 1,2;
INTO CURSOR crsTest
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform