Skip to content
Advertisement

Get the last entered id from a table in sql

enter image description hereI have an employee table. In that table I have n number of loan.. Now I want to select all the employees with his last taken loan value and date.. can anyone help me out in this.

There’s what I’ve done so far:

I tried group by, limit and order by for this but of no use… I also tried to take the last occurence of the employee_id that also didn’t work..

Advertisement

Answer

Update: to get the full row of max id:

I have to mention that your DB table design without primary key isn’t well designed: https://i.stack.imgur.com/DTYO8.png

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement