I have three tables called table1, table2 and table3 each table contains a primary key. products table common to all the three tables. which contain all the primary key of the three tables. no i want to display the products details as a nested array how can i do that?
table1 contains:
name
id
table2 contains:
name
id
table3 contains:
name
id
products table
id
name
description
table1_id
table2_id
table3_id
my output like 
table1 
{
name 
  { products.name, products.description },
  { products.name, products.description }
}
  table2
   name { products.name, products.description },
   { products.name, products.description }
  }
   table3
   {
   name {products.name, products.description},
  { products.name, products.description }
 
    