I want to fetch the most ordered items from the database.
For example: I have a following table:
S.no-----Name--------Items
1---------rob------------Pen, pencil, rubber
2---------jim------------rubber, scissor
3--------rick------------pen,pencil
I want to fetch most ordered items as shown below
S.no---item-------Count
1------Pen---------2
2------Pencil------2
3------Rubber------1
4------Scissor-----1
Below is the query i am using
SELECT name, items, count(items) AS cnt FROM tbl_orderitem GROUP BY items ORDER BY cnt DESC
but am not able to achieve the result as i want