Hi,
Is it possible to query a result set from another query?
Example
- List all employees by organization with ID #1 > returns 10 employees.
- From those 10 employees > List all employees working at department with ID #1 > returns 5 employees.
- From those 5 employees > List all employees at section with ID #1 > returns 3 employees.
This might sound ridiculous given my example but let’s assume that the result sets from step #1, #2 and #3 is fetched using a complex queries with nested ANDs and ORs then it’s quite complicated to build something which can calculates a filter which covers everything and being sure no data is leaking between the steps.
Using SQL it would be something like (not working but you get the idea )
select * from
(select * from
(select * from employees where organization = 10)
where department = 1)
where section = 1
Regards,
Anton