× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Aha! This:

SELECT a.name, b.somenum FROM michael/filea a, michael/fileb b
WHERE a.id = b.id and b.somenum in (select max(somenum) from
michael/fileb group by id)

Gives me this (I wanted the name):

NAME SOMENUM
Michael 55,555
Bob 11,111
Sue 33,333

Does this make sense? Is there a better way? Thanks...

On Wed, Mar 18, 2009 at 3:02 PM, Michael Ryan <michaelrtr@xxxxxxxxx> wrote:

So...I have two files...FileA has id and name, FileB has id and somenum. I
want to retrieve id, name and somenum, where somenum is the highest value of
somenum for that id. FileA is:
123, Michael
456, Bob
789, Sue

FileB is:
123, 44444
123, 55555
456, 11111
789, 33333
789, 22222

And I want:
123, 55555
456, 11111
789, 33333

How do I select greatest? Max? SELECT a.name, b.somenum FROM michael/filea
a, michael/fileb b
WHERE a.id = b.id gives me everything of course. A subselect?

Thanks...


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.