Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ds9
Starting Member
38 Posts |
Posted - 2007-03-09 : 15:16:14
|
| HiI am publishing a SQL view in excell using the external data/new database query option and accessing SQL server via ODBC datasource defined.The query I use aggregates data between 2 diferent dates. I am able to pass the initial date and the end date to SQL, but the results are not aggregated becase I am forced to put in the view the GroupBy clause for the field DATE. Is there any way of passing parameters to SQL (via Excell) and retrienve the aggregated data based on this parameters?Many Thanksds9 |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2007-03-09 : 16:29:46
|
| Post your query, we can't guess what you're trying to do. |
 |
|
|
ds9
Starting Member
38 Posts |
Posted - 2007-03-12 : 06:20:31
|
| HiThe view I want to access trough Excell is something like:SELECT Cluster, SUM(number_of_calls), SUM(number_of_drops)FROM Statistics_tableWHERE (data > '01-01-2007')GROUP BY ClusterThe question is that this statement is not showing the field date. If I choose the field date, adding it in the GROUP BY clause, it will not summarise the info from Statistics_table when sumoned by Excell.ThanksDS9 |
 |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2007-03-12 : 11:50:46
|
That's correct, because you are summarizing. If you summarize then what would the date show, there are lots of dates and they are all summarized, so you can't have a date column, unless you summarize it too. If you want that then something like this will summarize the date column and display it too.SELECT Cluster, MIN([Date]) AS [Date], SUM(number_of_calls), SUM(number_of_drops)FROM Statistics_tableWHERE ([Date] > '01-01-2007')GROUP BY Cluster |
 |
|
|
|
|
|
|
|