Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
SQL Query
Hi All,
How can I Group data in an Sql query based on month while the data on the table is based on Date? For Eg. Day Item Sales Purchase Amount TIA Soniya |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
SQL Query
Soniya
This sound like a perfect scenario for a pivot table. Take the option DataPivot table report and navigate to the sql table or view. This will bring the data to the pivot table designer. Drag the Day and Item fields as row fields and then the others as values Once you have them in as day data right click on the Day header and select Group. Select Months and if there is more than one year's worth, select years as well. -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England HIS "Soniya" wrote in message ... Hi All, How can I Group data in an Sql query based on month while the data on the table is based on Date? For Eg. Day Item Sales Purchase Amount TIA Soniya |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
SQL Query
Some hints:
Can't tell what your data looks like or where its is held i.e. Excel, Access, SQL Server , Oracle or ?. For SQL Server, (should also work when using Jet 4.0 (i.e. text, Excel, Access), a solution is: select distinct(dob), count(membno) as Freq, month(dob) as mth , sum(spa) as totspa from basic group by month(dob),dob,spa where basic = the table dob = a date (date of birth) membno = numeric, distinct on each row (same for character data) spa = numeric, an amount that can be summed. You can try to adapt this to your data. "Soniya" wrote: Hi All, How can I Group data in an Sql query based on month while the data on the table is based on Date? For Eg. Day Item Sales Purchase Amount TIA Soniya |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Import New Database Query (Union Query) in Spreadsheet | Excel Discussion (Misc queries) | |||
Convert hard coded query criteria to Parameter Query | Excel Discussion (Misc queries) | |||
Excel 2007 / MS Query - editing existing query to another sheet | Excel Discussion (Misc queries) | |||
Importing Data via Web Query - Can values be passed to query? | Excel Discussion (Misc queries) | |||
How to use a Access Query that as a parameter into Excel database query | Excel Discussion (Misc queries) |