hey guys, i have a bit of a strange question and dont know if what im asking can actually be done with mysql but here goes.
basically i have a table like so:
items
--------------------
item_id
category
sub_category
sub_sub_category
name
price
---------------------
now what im after is a result like so:
category sub_cat sub_sub_cat
[consoles] => [accessories] => [headsets] => [0] => ('name' => 'item1',
'price' => '10.00')
now ive seen a query which converts to json (but didnt work)
but would be great if its possible to do what i want it to do
SELECT
CONCAT("[",
GROUP_CONCAT(
CONCAT("{username:'",username,"'"),
CONCAT(",email:'",email),"'}")
)
,"]")
AS json FROM users;
any advise would be great
thank you