SQL SELECT LAST

SQL SELECT LAST : The last() function is used to return the last value of the specified column of a table.

Syntax for SQL SELECT LAST() FUNCTION:

SELECT LAST (column_name) FROM table_name;

You should note that the last() function is only supported in MS Access. But there are ways to get the last record in MySql, SQL Server, Oracle etc. databases.

Other SQL syntax:

SELECT column_name FROM table_name  ORDER BY column_name DESC  LIMIT 1;

SELECT TOP 1 column_name FROM table_name  ORDER BY column_name DESC;

SELECT column_name FROM table_name   ORDER BY column_name DESC  WHERE ROWNUM <=1;

Scroll to Top