0

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.

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.