Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete last record from SQL Server?

Tags:

sql

sql-server

I want to delete the last row from my table which I have 'no' is the auto number. Could anyone help me please?

no | name | sex | phone|
1    Jack    m     343
2     tim    f     233
like image 850
Ben Avatar asked Oct 14 '25 07:10

Ben


1 Answers

You may try this

DELETE FROM table
WHERE  no = (SELECT Max(no) FROM table)  
like image 173
DarkRob Avatar answered Oct 16 '25 21:10

DarkRob



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!