Xref: alice comp.databases.oracle.server:46795
Path: alice!news-feed.fnsi.net!newspump.monmouth.com!newspeer.monmouth.com!sunqbc.risq.qc.ca!wesley.videotron.net!weber.videotron.net.POSTED!not-for-mail
From: "Pierre Q.T. Nguyen" <pqtn@videotron.ca>
Newsgroups: comp.databases.oracle.server
References: <372117d9.2992633@news.twsc.pouchen.com.tw>
Subject: Re: How to do the SELECT?
Lines: 49
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Message-ID: <QEaU2.716$cy2.28844@weber.videotron.net>
Date: Fri, 23 Apr 1999 23:12:07 -0400
X-Complaints-To: abuse@videotron.net
X-Trace: weber.videotron.net 924923568 206.106.249.19 (Fri, 23 Apr 1999 23:12:48 EDT)
NNTP-Posting-Date: Fri, 23 Apr 1999 23:12:48 EDT

SELECT * FROM my_table
   WHERE odr_no IN
      (SELECT col_1 FROM
         (SELECT odr_no col_1, SUM(pay_rate) col_2 FROM my_table
           GROUP BY odr_no)
       WHERE col_2 = 100);

select * from contrat
where code_org_2 in
(select aa from
(select code_org_2 aa,sum(taux_majoration_reg_eloignee) bb from contrat
group by code_org_2)
where bb>80)


Violin a écrit dans le message
<372117d9.2992633@news.twsc.pouchen.com.tw>...
>Hello all,
>Need help again.
>If I have a table and here are the rows:
>
>ODR_NO  PAY_RATE QTY  PRICE
>----------------------------------------------------
>A0001          10                   5          10000
>A0001          20                   5          10000
>A0001          70                   5          10000
>B0001          30                 10            2000
>B0001          50                 10            2000
>C0001          40                   8          15000
>C0001          60                   8          15000
>D0001          80                   1          20000
>
>I want to select where SUM(PAY_RATE) = 100 ,
>How to return the results?
>
>ODR_NO  PAY_RATE QTY  PRICE
>----------------------------------------------------
>A0001          10                   5          10000
>A0001          20                   5          10000
>A0001          70                   5          10000
>C0001          40                   8          15000
>C0001          60                   8          15000
>
>Thanks for any tips.
>
>Violin.
>violin.hsiao@mail.pouchen.com.tw


