Excel > Microsoft Query > SQL Server > Multiple Parameters
Posted
by pojomx
on Stack Overflow
See other posts from Stack Overflow
or by pojomx
Published on 2010-04-22T16:31:34Z
Indexed on
2010/05/21
8:10 UTC
Read the original article
Hit count: 304
Hi, Im relatively new to sql server and excel/microsoft query,
I have a query like this
Select ...[data]...B1.b,B2.b,B3.b From TABLEA
Inner join (
SELECT ---[data]...sum(...) as b From TABLEB
WHERE Date between [startdate] and [enddate]
) as B1
Inner join (
SELECT ---[data]...sum(...) as b From TABLEB
WHERE Date between [startdate-1week] and [enddate]
) as B2
Inner join (
SELECT ---[data]...sum(...) as b From TABLEB
WHERE Date between [startdate-2weeks] and [enddate]
) as B3
Where Date between [startdate] and [enddate]
It works, when i introduce the dates manually, but i need them to be "Dynamic" (introduced from excel) but, when I put the "?" (for parameters) on all the dates, it throws an error.
"Invalid Parameter Number"
:D How can i make this work, within excel?
Im using SQL Server and Microsoft Query Connection Data.
© Stack Overflow or respective owner