开发者

Getting data from a complex query to excel

开发者 https://www.devze.com 2023-01-27 02:19 出处:网络
I\'ve got a query which I want to depend on certain parameters from an excel sheet, but I get the error \'parameters are not allowed in queries that can\'t be displayed graphically\'. The only way to

I've got a query which I want to depend on certain parameters from an excel sheet, but I get the error 'parameters are not allowed in queries that can't be displayed graphically'. The only way to get around it that I see is to use a view, but how much extra overhead would that give? It would mean joining two tables (one with near 70000 and one with over 200000 records and both having around 40 fields) into that view, probably using only 5 or so of the total 80 fields. We do not have a test server. Alternatively, is there a way to change the following query to one for which microsoft query does allow parameters?

select count(distinct a) from table1 where b=0 and c < '2010-01-01' and a in 
(select a from table2 where d between '2010-01-01' and '2010-12-31') 

or as a join:

select count(di开发者_Go百科stinct table1.a) from table1 inner join table2 on (table1.a=table2.a 
and table2.d between '2010-01-01' and '2010-12-31') where table1.c < '2010-01-01'
and table1.b=0

I want to replace the dates (for c and d) with cellvalues.

Thanks,

Ernst


Have you considering migrate the data from Excel to SQL-Server tables and then execute the query?. The most of the DBMS have tools for data migration.

0

精彩评论

暂无评论...
验证码 换一张
取 消