Many to Many Relation

Hey Everyone,

Here is what I have to do. We are building an IMS system and one of the key functionalities of this system is creating a picking list.

What this is is users select multiple orders like the following

Order 1
Order 2
Order 3

These are the orders they want to go fetch from the stock room. So I store this in a table called userBatchSelection (i could probably do this with an array variable but anyway)

What i want to do is to go fetch the items in those orders from the "orderLineItems" table. And also aggregate them.

Order 1 -Product 1 x1
Order 1- Product 2 x2
Order 2- Product 2x1
Order 3 -Product 3 x4

Is there a way of fetching all the records at once or would I have to add a loop to the api call that iterates though each order?

And are there any resources explaining these types of queries?

5 replies