How to nested queries with pagination?

I dont know how far into the project you are but I stongly suggest you revise your data structures if you can as your current structure is going to make things much more difficult than it needs to be.
If you dont fully understand how subtables work then perhaps view this video which hopefully should highlight how to optimise your data structure which will kake everything much easier.

If you dont want to watch it all (i suggest you do as it contrasts what you are doing with a subtables approach) then subtables are dealt with about 15 minutes in

1 Like