I've been doing something similar for a while. I run multiple queries simultaneously and then perform operations on the tables. I have adapted my solution for your application. It's not pretty, but I have tried many, many other ways in JMP, and nothing else has accomplished what I wanted.
Names Default To Here( 1 );
o_connections = {....Connection List....};
o_sqls = {....Query List....};
::i_dts = {};
Run_SQL_Queries = Function( {o_connection, o_sql, i_counter},
{Default Local},
Eval(
Eval Expr(
Expr(
Parse( "::i_dt" || Char( i_counter ) || " = Empty()" )
);
New SQL Query( Connection( o_connection ), Custom SQL( o_sql ) ) << Run Background(
OnRunComplete(
Expr(
Parse( "::i_dt" || Char( i_counter ) || " = QueryResult;" )
);
Insert Into( ::i_dts, QueryResult )
;
)
);
)
)
);
For( i=1, i<=N Items(o_connections), i++, Run_SQL_Queries( o_connections[i], o_sqls[i], i ) );
For( i = 1, i <= N Items( o_connections ), i++,
Eval( Parse( "While(!Is Scriptable(::i_dt" || Char( i ) || "), Wait(.5))" ) )
);
Show( ::i_dt1, ::i_dt2, ::i_dts );