I want to get records corresponding to maximum serial number

Posted by Amritha444 under Sql Server on 7/9/2012 | Points: 10 | Views : 1766 | Status : [Member] | Replies : 1
Hi all

I want to get records corresponding to maximum serial number

slno date name

1-22-12-2011-1 1/1/2012 Amrutha
1-22-12-2011-2 1/1/2012 Arjun
1-22-12-2011-3 1/1/2012 Anisha

I want a query which returns data corresponding to slno 1-22-12-2011-3 i mean maximum in last postion.how write query for it .my database is MySQL.

Thanks In Advance
Amrutha




Responses

Posted by: Manicse on: 7/9/2012 [Member] Bronze | Points: 25

Up
0
Down
Amritha,

Hope you have set Slno as a Varchar or Char type
if so, even the MAX keyword will work.

Select * from table_name where slno =
(Select MAX(slno) from table_name)

ORelse

you can use LEFT or RIGHT keyword.



Mani.R

Amritha444, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response