我有一张看起来像这样的桌子
id | itemID | catID | Title ---------------------------------------------------------------------------- 0 3 4 Hello 1 3 6 Hello 2 4 4 Yo 3 4 8 Yo 4 5 2 Hi 5 1 3 What
I want to do a MySQL PHP Select that only gets one occurrence of the itemID. As you can see they are the same item, just in different categories.
This is what I tried
SELECT * FROM Table GROUP BY itemID
这似乎不起作用,它仍然显示重复项。
最佳答案
这是你想要的? http://www.sqlfiddle.com/#!2/5ba87/1
select itemID, Title from test group by itemID;
关于php - 在基于ID的mysql PHP中仅出现一次表行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15075177/