List:General Discussion« Previous MessageNext Message »
From:noel.clarkson Date:July 9 2002 5:39am
Subject:RE: UDF, Can anyone please help?
View as plain text  
So if below is actually what your data looks like, what about:

Select Field1, Field2, MAX(IDField) From MyTable Group by Field1

That might get the correct answer for you, but it does however have an extra
field in the result (which may or may not be a problem).

cheers,

noel

filter word:mysql

On Tuesday, July 09, 2002 7:03 AM, Miles Roper
[SMTP:mroper@stripped] wrote:
> Hi Frank,
> 
> Good idea, but I actually need the last value, ie
> 
> IDField  Field1   Field2
> 1        A        1
> 2        A        4
> 3        A        2
> 4        A        3
> 5        B        7
> 6        B        10
> 7        B        3
> 8        B        8
> 9        C        1
> 10       C        2
> 11       C        4
> 12       C        1
> 
> The answer would be
> 
> select field1, last(field2) from table1 group by field1
> 
> Feild1   Field2
> A        3
> B        8
> C        1
> 
> Select Field1, Max( Field2 ) From MyTable Group by Field1
> 
> Would produce a wrong answer
> 
> Feild1   Field2
> A        4
> B        10
> C        4
> 
> I'm keeping an eye on the mailing list via the net. :o)  I get to many
> emails as it is :o)
> 
> Hope this makes sense :o)  Thanks for you help.
> 
> Cheers
> 
> Miles
> 

Thread
UDF, Can anyone please help?Miles Roper8 Jul
  • Re: UDF, Can anyone please help?Francisco Reinaldo8 Jul
RE: UDF, Can anyone please help?Miles Roper8 Jul
RE: UDF, Can anyone please help?noel.clarkson9 Jul
RE: UDF, Can anyone please help?Miles Roper9 Jul
RE: UDF, Can anyone please help?Miles Roper9 Jul