Help with a join

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi there,

I was hoping someone could help me out here.

I have a table which has columns seq and price. Some sample rows are...

seq  price
1    34
1    35
2    25
2    29
2    31
3    31
4    30
4    31

I would like to return the single row which the largest seq number and
smallest price within that seq group. So for the example above the
second to last row would be returned (seq=4, price=30).

I am running MySQL 4.0.20 so unfortunately I cannot do subqueries.
Would someone be able to suggest how this could be done with joins?


Re: Help with a join wrote:

Quoted text here. Click to load it

The following should help you:

  MAX(seq), MIN(price)
  FROM atable
  GROUP BY seq
  LIMIT 0,1

I'm running 4.0.17


Site Timeline