Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have a variable vField . Its value is 'a','b','c','d'
How do I write a SQL query to check where field matches any values (a or b or c or d) in vField variable?
Thanks!
LIB CONNECT TO database1;
Table1:
Load Field,
1 as PlaceHolder;
select distinct Field from db1.xyz
where ....
;
Table2:
load
Concat(chr(39)&Field &chr(39),',') as Field_new
Resident Table1
Group by PlaceHolder;
Drop Table Table1;
let vField = Peek('Field_new', 'Table2');
Drop Table Table2;
LIB CONNECT TO database2;
Data:
Load *;
sql select * from
db2.abc
where Field_table2 in $(vField)
that works. thanks!
Hi,
I have a similar situation that variable is holding no value .. when executing the script I get error Error in 'expression:
WildMatch takes at least 2 parameters'
temp1:
load Concat(DISTINCT Chr(39)& columnname&Chr(39),',') as columnnameList
Resident Temp;
drop Table Temp;
let vVar11=peek('columnnameList',0,'temp1');
set List=$(vVar11);
test:
NoConcatenate
LOAD DISTINCT
column1,
Resident maintable
where wildmatch(columnname, $(List));---the script is failing at below condition
Any insight would be greatly appareciated.