Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I'm wondering if there is a way to make a load script using a SQL query with dynamic update of the where clause ?
Example :
Id_Customers:
LOAD
Id_Customers
FROM
FileA;
SQL SELECT
Customer_Id, Customer_name
FROM customers
Where customers.Customers_Id = (or in) Id_Customers (this data come from the file load above);
Thanks
Try with a variable
Id_Customers:
LOAD * INLINE [
Id_Customers
1
2
3
];
TMP2:
LOAD CONCAT(Id_Customers, ', ') as Field2 RESIDENT Id_Customers;
LET vField2= PEEK('Field2', 0, 'TMP2'); // vField2 = 1, 2, 3
SQL SELECT Customer_Id, Customer_name
FROM customers
Where customers.Customers_Id IN ($(vField2))
;
Try with a variable
Id_Customers:
LOAD * INLINE [
Id_Customers
1
2
3
];
TMP2:
LOAD CONCAT(Id_Customers, ', ') as Field2 RESIDENT Id_Customers;
LET vField2= PEEK('Field2', 0, 'TMP2'); // vField2 = 1, 2, 3
SQL SELECT Customer_Id, Customer_name
FROM customers
Where customers.Customers_Id IN ($(vField2))
;
Alternatively you can use EXISTS()
Example :
Id_Customers:
LOAD
Id_Customers
FROM
FileA;
TableB:
Load *
Where Exists(Id_Customers,Customers_Id);
SQL SELECT
Customer_Id, Customer_name
FROM customers;