Nesting nuSQL queries
Posted: Sun Mar 05, 2023 11:14 am
Hi there,
I'm hoping someone can please help advise, can you have a nuSQL refer to another nuSQL.
That is, I have a query, that relies on a sub query. And in fact, that sub query, also has a sub query. Rather than repeat that base SQL directly within each of the other two queries, I want to be able to refer to that base query, so that if I make changes I only have to make it in the one place.
In very basic pseudocode terms:
select * from table as qr1
select * from qry1 join table2 on id=id as qry2
select * from qry2 join table3 on id=id as qry3
I'm trying to avoid:
select * from table as qr1
select * from (select * from table as qr1) join table2 on id=id as qry2
select * from (select * from qry1 join table2 on id=id as (select * from table as qr1)) join table3 on id=id as qry3
Thanks,
Nick
I'm hoping someone can please help advise, can you have a nuSQL refer to another nuSQL.
That is, I have a query, that relies on a sub query. And in fact, that sub query, also has a sub query. Rather than repeat that base SQL directly within each of the other two queries, I want to be able to refer to that base query, so that if I make changes I only have to make it in the one place.
In very basic pseudocode terms:
select * from table as qr1
select * from qry1 join table2 on id=id as qry2
select * from qry2 join table3 on id=id as qry3
I'm trying to avoid:
select * from table as qr1
select * from (select * from table as qr1) join table2 on id=id as qry2
select * from (select * from qry1 join table2 on id=id as (select * from table as qr1)) join table3 on id=id as qry3
Thanks,
Nick