我正在选择行
SELECT `playerid` FROM `lb-world` WHERE replaced=50 AND type=0 >= 0.01
但在我的桌子上我有
playerid | replaced | type | date
12 | 50 | 0 | 2010
12 | 50 | 0 | 2011
12 | 50 | 0 | 2012
如何只选择一次?
我正在选择行
SELECT `playerid` FROM `lb-world` WHERE replaced=50 AND type=0 >= 0.01
但在我的桌子上我有
playerid | replaced | type | date
12 | 50 | 0 | 2010
12 | 50 | 0 | 2011
12 | 50 | 0 | 2012
如何只选择一次?
试试这个:
SELECT `playerid` FROM `lb-world`
WHERE replaced=50 AND type=0
GROUP BY playerid, replaced, type
这应该是通用的。
无论如何,如果你确定你只想要 playerid,使用这个
SELECT DISTINCT playerid FROM lb-world
WHERE replaced=50 AND type=0
如果你只想要playerid
,你可以使用DISTINCT
SELECT DISTINCT `playerid` FROM `lb-world` WHERE replaced=50 AND type=0 >= 0.01
SELECT DISTINCT playerid..
正如@Michael 所说