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

Home -> Community -> Usenet -> c.d.o.tools -> Re: A NEWBIE QUESTION ON SQL

Re: A NEWBIE QUESTION ON SQL

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 2000/06/10
Message-ID: <8htinb$qhf$1@nnrp1.deja.com>#1/1

In article <394243D8.6F12F9E6_at_swt.edu>,
  Praveen <praveen_at_swt.edu> wrote:
>
> --------------0D7A7375526DC6F2967516F0
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Hi,
>
> I have a table "tab" :
>
> per_no acc_attempt percentage
> 1 1 76
> 1 2 56
> 1 3 85
> 2 1 55
> 2 2 65
> 2 3 75
> 3 1 45
> 3 2 55
> 3 3 65
> 3 4 75
>
 

> I am trying to write a query that can retrieve the rows which i have
> highlighted and underlined above from the table, that is i want those
> rows to be retrieved from the table where for each 'per_no' the
> 'acc_attempt' is maximum.
>
> Can anybody suggest a way to accomplish this?
>

yikes -- newsgroups are text, not html. "underline", "highlighted" -- they have no meaning here ;) (that html below is really hard to read)

fortunately you provided enough other info that I think I can answer....

select *
  from T
 where acc_attempt = ( select max(acc_attempt)

                         from t t2
                        where t2.per_no = t.per_no )
/

> Thankyou
> Praveen
>
> --------------0D7A7375526DC6F2967516F0
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> Hi,
> <p>I have&nbsp; a table&nbsp;&nbsp; "tab" :
>

<p>per_no&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> acc_attempt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; percentage
> <br>&nbsp;&nbsp;&nbsp;

1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;

>

[snip]

>

--
Thomas Kyte (tkyte_at_us.oracle.com) Oracle Service Industries
Howtos and such: http://osi.oracle.com/~tkyte/index.html
Oracle Magazine: http://www.oracle.com/oramag
Opinions are mine and do not necessarily reflect those of Oracle Corp


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Sat Jun 10 2000 - 00:00:00 CDT

Original text of this message

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