Tuesday, 30 August 2011

How to find second maximum value from a table?

1. select * from myTable WHERE myId = (SELECT  MAX(myId-1) FROM myTable)
2. select  MAX(myId-1) from myTable
3. select * from myTable where myId=(select max(myId) from myTable where myId<(select max(myId)
    from myTable))

No comments:

Post a Comment