Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: simple max function query

Re: simple max function query

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Tue, 24 Aug 1999 10:16:36 +0200
Message-ID: <7ptke7$3q3$1@oceanite.cybercable.fr>


Paul's query returns the row with the max rowid which is not the last one.

If i understand John. You want the row which the max tar_status_number for a particuliar tar_status_tar.
In this case try this statement:

select tar_status_number, tar_status_tar, tar_status_status from tar_status
where tar_status_tar = '106988'
  and tar_status_number =

        (select max(tar_status_number) from tar_status
         where tar_status_tar = '106988');


Paul Q a écrit dans le message ...
>
>max - returns largest value in the field.
>
>
>select * from table
>where rowid = (select max(rowid) from same_table)
>
>
>john bruin wrote in message <37C1D7CF.255C_at_tssc.co.nz>...
>>Can someone show me how to get the last value in a column.
>>I thought the max function would do it but it just shows all the values
>>whereas I only want the last row value.
>>
>>select tar_status_tar
>> ,max( tar_status_number) "max"
>> ,tar_status_status
>>from tar_status
>>where tar_status_tar = '106988'
>>group by tar_status_status
>> ,tar_status_tar
>> ,tar_status_number
>>
>>
>>Thanks in advance.
>>John
>
>
Received on Tue Aug 24 1999 - 03:16:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US