Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I'm trying to do a load from a SQL database with a where clause that looks at a QVD. Is this possible?
Something like this
LOAD
Record,
Name,
Address;
SQL SELECT *
FROM $(vDB).customer
WHERE Record IN [D:\MyTable.QVD] (QVD);
@SimonDB Or the third option is to construct a variable which can then be passed to your sql
Temp:
LOAD Concat(DISTINCT Chr(39) & Record & Chr(39), ',') as ConcatRecord
From [D:\MyTable.QVD] (QVD);
LET vConcatRecord = Peek('ConcatRecord');
and then you can use this variable in your SQL
LOAD Record,
Name,
Address;
SQL SELECT *
FROM $(vDB).customer
WHERE Record IN ($(vConcatRecord));
Hi Simon,
Try like this
Temp:
Load Distinct Record from [D:\MyTable.QVD] (QVD);
LOAD
Record,
Name,
Address where exists(Record);
SQL SELECT *
FROM $(vDB).customer;
or you can use inner join also.
Temp:
Load Distinct Record from [D:\MyTable.QVD] (QVD);
Inner Join
LOAD
Record,
Name,
Address;
SQL SELECT *
FROM $(vDB).customer;
@SimonDB Or the third option is to construct a variable which can then be passed to your sql
Temp:
LOAD Concat(DISTINCT Chr(39) & Record & Chr(39), ',') as ConcatRecord
From [D:\MyTable.QVD] (QVD);
LET vConcatRecord = Peek('ConcatRecord');
and then you can use this variable in your SQL
LOAD Record,
Name,
Address;
SQL SELECT *
FROM $(vDB).customer
WHERE Record IN ($(vConcatRecord));
Thank you both for your replies