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 S开发者_如何学JAVAQL Server and Microsoft Query Connection Data.
Take a look at this thread, then this page to see examples of using parameters with ADO.
You should try naming parameters like this: @parameter1
精彩评论