List:General Discussion« Previous MessageNext Message »
From:Arno Coetzee Date:November 4 2005 8:07am
Subject:Re: Help with an SQL query
View as plain text  
Gobi wrote:

> Not sure if this is the right place to ask.  I have a table, Weight, 
> with the following test data:
>
> idx  VBS_ID   Date            Weight
> 1    111111    10/3/2005    11.5
> 2    111111    9/5/2004      10
> 3    111111    10/7/2005    11.51
> 4    111111    10/8/2005    11.52
> 5    111112    10/8/2005    10.5
> 6    111112    10/1/2005    10.3
> 7    111112    9/28/2005    10
>
> What I would like to do is to get the most recent weight for each 
> unique VBS_ID.  So, in this case, I want a result of:
>
> 111111, 10/8/2005, 11.52
> 111112, 10/8/2005, 10.5
>
> Can anyone tell me how to do this?  Thanks.
>
select VBS_ID , max(Date)
from weight

-- 
Arno Coetzee
Developer
Flash Media Group
Office : +27 12 342 3490
Mobile : +27 82 693 6180
Fax : + 27 12 430 4269
www.flashmedia.co.za

<<FMG Total messaging solution.  For all your GSM (SMS and USSD) messaging needs. 
Quick and easy do-it-yourself interfaces. http://www.flashmedia.co.za/tms.php >>

Thread
Help with an SQL queryGobi4 Nov
  • Re: Help with an SQL queryArno Coetzee4 Nov
    • Re: Help with an SQL queryGobi4 Nov
      • Re: Help with an SQL queryGobi4 Nov
        • Re: Help with an SQL queryJohan Höök4 Nov
          • Re: Help with an SQL queryGobi4 Nov
          • Re: Help with an SQL queryGobi4 Nov
  • Re: Help with an SQL queryRhino5 Nov
    • Re: Help with an SQL queryGobi6 Nov
Re: Help with an SQL queryJohan Höök4 Nov
  • Re: Help with an SQL queryGobi4 Nov
    • How to select on passwords?Gobi4 Nov
      • Re: How to select on passwords?Gobi4 Nov
Re: Help with an SQL queryGobi5 Nov