How do I select distinct one column and return the other column data that has been distincted?
Assuming you are using MySQL

Here is how I'd do the SQL:

SELECT
ID,
ITEMNAME,
CONCAT("select tag(",GROUP_CONCAT(DISTINCT size
                                  ORDER BY size DESC
                                  SEPARATOR "/"), ')') AS SIZE
FROM items
GROUP BY ITEMNAME 


Results:

| ID |      ITEMNAME |            SIZE |
|----|---------------|-----------------|
|  1 |  Blue T-shirt | select tag(M/L) |
|  3 |   Red T-shirt |   select tag(M) |


SQL Fiddle

Once you have it in PHP you can then iterate it out.