Get last id from table

Get last id from table

deny68deny68 Posts: 5Questions: 1Answers: 0
edited March 2017 in Editor

What is the best way to retrive last id from MySql table using sql string "'SELECT id FROM tablename ORDER BY id DESC LIMIT 1;'"? (id is primary key with no AutoIncrement) It should be done in "... open event, which is triggered when the Editor form is shown to the end user ...", in CREATE mode. It would be very useful in situations when end user needs to control id field, for example if it is a id number of some kind of document. This way you could suggest last id + 1 as new id and end user can accept it or overwrite it.

Thanks in advance.

This discussion has been closed.