1

如何将以下两个 MySQLSELECT语句放在一个PHP查询中?

$SQLquery = "SELECT MAX(ID) AS last_id FROM table";
$SQLquery = "SELECT full_name FROM table";

谢谢,美好的一天。

4

1 回答 1

1

您无需使用即可获得最新记录MAX

SELECT  *
FROM    tableName
ORDER   BY ID DESC
LIMIT   1

但是如果你肯定想使用MAX

SELECT  *
FROM    tableName
WHERE   ID = (SELECT MAX(ID) FROM tableName)
于 2013-02-26T13:35:30.317 回答