我有这张桌子:
server_records:id int(AUTO_INCREMENT),record int,time int
如果我想获得最高记录的领域,我该怎么做?
SELECT `record` FROM `server_records` WHERE `record` = highest?!
答案 0 :(得分:2)
SQL Server:
SELECT TOP 1 * FROM server_records
ORDER BY record desc
MySQL的:
SELECT * FROM server_records
ORDER BY record desc
LIMIT 1;
答案 1 :(得分:2)
最高记录,而不是ID,是吗?
SELECT MAX(record)
FROM server_records
或者,如果您想要所有字段:
SELECT *
FROM server_records
WHERE record =
( SELECT MAX(record)
FROM server_records
)