Jump to content

SQL LAST() function


adicrst

Recommended Posts

According to W3schools to get the last record from a column i can use the LAST() function. Everything looks smooth until i test it using phpMyAdmin - 2.10.0.2MySQL client version: 4.1.15andphpMyAdmin - 2.11.1MySQL client version: 5.0.45it doesn't work ! I get the wrong syntax error :) what the ###### ?

Link to comment
Share on other sites

The LAST method is for Access.You can do the following to achieve the same results

SELECT columnId FROM myTable ORDER BY columnId DESC LIMIT 1

This will return the last columnId in the table. You can adjust the ORDER BY and add in a WHERE as needed to suit your needs.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...