Jump to content

Recommended Posts

AmandaF, it's uncertain which column the user wants the MAX of. It may not be ID, but your solution is a good one if that is the case. :)

 

If vikela doesn't want the ID, then

 

SELECT ID, colum_that_vikela_wants_the_max_of FROM table ORDER BY column_that_vikela_wants_the_max_of LIMIT 1

 

Of course, if the column isn't unique and more than one row has the max value, then only one of those rows will get returned.  In that case, it would be better to use the max() function.

AmandaF:

1. No need to select ID.

2. You forgot DESC in your ORDER BY clause.

 

Let's just wait for vikela to reply. Let's not guess.

 

1) I thought vikela would need to be able to identify which row the result belonged to.

2) Thanks for catching that for me.

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.