Jump to content

Stucked up with MySQL


atitthaker

Recommended Posts

I didn't find anyother place to post the query so I am posting it here.

This is my table like:
ID name
1  t1
3  t2
5  t3
7  t4
2  t5

Now I want to find out the row with 3rd maximum ID. In this case the raw with id 3.
I tried many ways but I am unable to get work arround this. MySQL is not supporting IN construct with my version.




Plz Help

Thanks
Link to comment
Share on other sites

First, all versions support the IN clause.  Second, why do you ever want to 3rd largest ID?  Third, the following should work:

[code]
SELECT * FROM yourTable ORDER BY ID LIMIT 3,1
[/code]

Assuming that there are at least 3 entries in your table.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.