RevQueryDatabase help

mfstuart at cox.net mfstuart at cox.net
Fri Mar 18 13:44:45 EST 2005


Bill,

If you want to get the last ID from a table in MySQL, use the following SELECT statement, and put the result into a variable - which will be the last ID value in that table:

SELECT id FROM tripulatnes ORDER BY id DESC limit 1

This selects the column: id from the table: tripulantes, and sorts the table by column: id, in descending order. This returns the last record in the table. Warning: this only returns the last record, not the greatest (or MAX) value in that column, which I'm assuming is the Primary Key to the table.

Now if you want the MAX value returned from the column: id, use the following SELECT statement:

SELECT MAX(id) FROM tripulantes



More information about the Use-livecode mailing list