LAST() 函数
LAST() 函数返回指定的列中最后一个记录的值。
SQL LAST() 语法
SELECT LAST(column_name) FROM table_name;
注释:只有 MS Access 支持 LAST() 函数。
SQL Server、MySQL 和 Oracle 中的 SQL LAST() 工作区
SQL Server 语法
SELECT TOP 1 column_name FROM table_name
ORDER BY column_name DESC;
实例
SELECT TOP 1 name FROM Websites
ORDER BY id DESC;
MySQL 语法
SELECT column_name FROM table_name
ORDER BY column_name DESC
LIMIT 1;
实例
SELECT name FROM Websites
ORDER BY id DESC
LIMIT 1;
Oracle 语法
SELECT column_name FROM table_name
ORDER BY column_name DESC
WHERE ROWNUM <=1;
实例
SELECT name FROM Websites
ORDER BY id DESC
WHERE ROWNUM <=1;