Hi,
Within a JMP script I really need to query both a saved JMP table and a seperate database table, but cannot work out how or find a solution online. There is a simplified example code below. The issue is once I have connected to the db I can no longer Query local tables. I know I could do a table join in JMP after the SQL Query on the external db, but the goal is to only pull customers specified in the customers.jmp table in the query to reduce how much data it needs to query. I have tried things such as JOIN 'cust', JOIN 'Customers' etc.
Any help would be greatly appreciated thanks.
// open JMP table
cust = Open( "***\JMP Tables\Customers.jmp");
//connect to DB
SQLConnection = Create database connection("DRIVER=*** SERVER=***; DATABASE=database; Uid=***;Pwd=***");
//Query both
PrePUSQL01 =
"
SELECT
T.CustomerID,
C.Inc
FROM database.dbo.table AS T
JOIN cust AS C ON C.CustomerID = T.CustomerID
WHERE C.Inc = '1'
"
;
dt = Execute SQL(SQLConnection,
PrePUSQL01,
"dt"
);