Select the last record from tabel

how to select the last record from the table
there is two option:
1. Select the maximum id
Select id from inventory where id in (select max(id) from inventory )

but it takes a a lot of execute time... coz you must execute two select plan and one where
2. The limit
Select id from inventory order by id Desc limit 1
this the fastest way....

0 comments:

Posting Komentar