i have table like this
+----+-------+-------------+ | id | items | name | +----+-------+-------------+ | 1 | 1,2,3 | hot deals | | 2 | 2,3,4 | offers | +----+-------+-------------+
where items are the id of product
here is the product table (mini version)
+-----------+--------------------+ | productid | productname | +-----------+--------------------+ | 1 | sony mobile | | 2 | iphone 4s | | 3 | dell laptop v1 | | 4 | samsung mouse | +-----------+--------------------+
i need to get result as array of items with name ex [hot deals =>[(1,sony mobile),(2,iphone 4s),(3,dell laptop v1 ) ],offers=>[--]]
can achieve this in (MYSQL)stored procedure if not how can i achieve this with minimum numberof queries side note:first table will have maximum of 6 rows