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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to write SQL statement.

Re: How to write SQL statement.

From: R.Schierbeek <bytelife_at_worldonline.nl>
Date: Mon, 14 Sep 1998 13:38:30 +0200
Message-ID: <6tiu8o$b8k$1@news.worldonline.nl>


Hello Aung,
I'm not sure if you want as you dont explain much, but a group by query like this one might do it:

select A.col1,sum(A.col2),sum(B.col3)
from A, B
where A.col1 = B.col1
and A.col2 = B.col2
group by A.col1
/

Good luck !



Roelof Schierbeek, DBA
Bytelife BV
The Hague, Holland
email: bytelife AT worldonline.nl
check out : http://home.worldonline.nl/~bytelife

Aung Aung > heeft geschreven in bericht
>Hello,
>
>I have one problem to retrieve data in one statement. It is as follows:
>Table A. col1 col2 col3
> A X 100
> A Y 200
> B X 100
>
>Table B. A X 10
> A X 20
> A Y 10
> A Y 20
> B X 50
>
>I would like to have the result as
> A 300 60 (A,300 from Table A, 60 from Table B)
> B 100 50 (B,100 from Table A, 50 from Table B)
>
>Thank you,
>Aung.
Received on Mon Sep 14 1998 - 06:38:30 CDT

Original text of this message

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