How to get the First and Last Record of DB
mysql
Solution
Depends what you mean by "first" and "last".
You can "ORDER BY" a specific column, and choose "LIMIT 1", and then "ORDER BY ... DESC" to get the reverse.
e.g.
SELECT * FROM table ORDER BY col LIMIT 1
SELECT * FROM table ORDER BY col DESC LIMIT 1
...and if you want both in the same query:
SELECT * FROM table ORDER BY col LIMIT 1
UNION
SELECT * FROM table ORDER BY col DESC LIMIT 1
Problem
How can I retrieve the first and last record from a table. Note : I am not going do to order by