How to combine and retrieve values three tables

Posted 2 years ago by maxhas79

these are my three tables

-SALES -id -details

-SALES_ITEMS -sale_id -item_id

-ITEMS -id -name

After a sale done will push sale details to SALES table and push items of that sale to SALES_ITEMS table with 'id' from SALES table.item name are in ITEMS table..so i need to retrive datas from all three combined..like below:- {sales{[id:1, Details:..., sale_items:{[id:1 Item_id:1 item:{[id:1 name:item-name]}]}]}}

How to setup model and how to use that in controler? Ps: dont mind json typos..posting from mobile

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.