problem

A

adrian.popescu

Hi

I have a problem in excel when i try to import data from MSSql with
Import
external data: I must use the same condition in two places in the same
query..something like that:

select col2 from d where col1=? union select col3 from d where id not
in
(select col2 from d where col1=?)

this query works perfectly in MSSql, but when I try to do this in my
".dqy"
file the excel tell me I have an error in my sql...

pls help me
 
N

NickHK

MSQuery seems to expect a separate input for each parameter; it cannot tell
that "col1" is repeated and the repeat seems to cause a problem.
If you call the second instance something else, does it work ?
Also, how are you filling the parameters ?

NickHK
 
A

adrian.popescu

NickHK said:
MSQuery seems to expect a separate input for each parameter; it cannot tell
that "col1" is repeated and the repeat seems to cause a problem.
If you call the second instance something else, does it work ?
Also, how are you filling the parameters ?

NickHK

yes...if I put, for example, a static value:
select col2 from d where col1=? union select col3 from d where id not
in
(select col2 from d where col1='X')
is working
 
N

NickHK

Can't you set the parameter values to cell values ?
So both "col1" value point to the same cell.

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top