I am newbie to SQL and PHP programming so please be patient with me. :)
For example I have one table with three fields: ID, ITEMNAME, SIZE, and data like this:
+----+--------------+-------+
| ID | ITEMNAME | SIZE1 |
+----+--------------+-------+
| 1 | Blue T-shirt | M |
+----+--------------+-------+
| 2 | Blue T-shirt | L |
+----+--------------+-------+
| 3 | Red T-shirt | M |
+----+--------------+-------+
And I want to display it using SQL command as:
+--------------+-----------------+
| ITEMNAME | SIZE |
+--------------+-----------------+
| Blue T-shirt | select tag(M/L) |
+--------------+-----------------+
| Red T-shirt | M |
+--------------+-----------------+
The items with the same name will merged and create a select tag with the option of the size column data. How can I do that?
Any other way will be appreciated.
GROUP BYon item name and aGROUP_CONCATon size.. not 100% though – jamesmstone Jan 24 '18 at 09:08