从同一列中的许多相同值中获取一个值

时间:2018-09-29 16:32:38

标签: php mysql mysqli

我只想从一列中的这些匹配值中取一个值并将其放入select

SELECT company FROM `main_fore` ORDER BY `fore_id`

Like this column in this picture

1 个答案:

答案 0 :(得分:0)

您要寻找select distinct还是group by

SELECT company
FROM main_fore 
GROUP BY company
ORDER BY MIN(fore_id)