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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Publishing a view in Excell with parameters

Author  Topic 

ds9
Starting Member

38 Posts

Posted - 2007-03-09 : 15:16:14
Hi

I 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 Thanks
ds9

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.
Go to Top of Page

ds9
Starting Member

38 Posts

Posted - 2007-03-12 : 06:20:31
Hi

The view I want to access trough Excell is something like:


SELECT Cluster, SUM(number_of_calls), SUM(number_of_drops)
FROM Statistics_table
WHERE (data > '01-01-2007')
GROUP BY Cluster

The 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.


Thanks
DS9

Go to Top of Page

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_table
WHERE ([Date] > '01-01-2007')
GROUP BY Cluster
Go to Top of Page
   

- Advertisement -