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: SQL Query question

Re: SQL Query question

From: Nuno Guerreiro <nuno-v-guerreiro_at_telecom.pt>
Date: Tue, 02 Jun 1998 09:42:45 GMT
Message-ID: <357ac90d.173872104@news.telecom.pt>


On Mon, 01 Jun 1998 22:01:37 GMT, bobmc_at_cyberramp.net (Bob McConnell) wrote:

>I have a table with columns ID and TASKNO which
>looks like:
>
>TASKNO ID
>1 JOB1
>2 JOB1
>3 JOB1
>1 JOB2
>2 JOB2
>1 JOB3
>2 JOB3
>
>I need to be able to select one of each ID
>based on the highest TASKNO
>
>Resulting in
>TASKNO ID
>3 JOB1
>2 JOB2
>2 JOB3
>

Open SQL*Plus and issue the following command:

select max(taskno),id
from table
group by id
order by id;

Hope this helps,

Nuno Guerreiro Received on Tue Jun 02 1998 - 04:42:45 CDT

Original text of this message

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