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 create the SELECT script?

Re: How to create the SELECT script?

From: <nasof_at_hotmail.com>
Date: Wed, 12 Aug 1998 13:47:39 GMT
Message-ID: <6qs6ds$nn1$1@nnrp1.dejanews.com>


I think you might want to post a question like this to COMP.DATABASES.ORACLE.MISC next time.

In any case, try:

select t1.acc_no, t1.acc_nm, sum(t2.amt) from table1 t1, table2 t2
where t1.acc_no = t2.acc_no
group by t1.acc_no, t1.acc_nm

If you are beginning a project, I suggest picking up a book on basic sql and begin practicing with it.

In article <35d1597b.33147914_at_news.twsc.pouchen.com.tw>,   violin.hsiao_at_mail.pouchen.com.tw (Violin) wrote:
> Hello,
> I have a select problem,I hope someone could help me!
>
> There are 2 tables:TABLE1 is master,TABLE2 is detail.
> And the data is:
>
> TABLE1:
> ACC_NO ACC_NM
> ---------------------------------
> 10 Training cost
> 20 Traffic cost
> 30 Medical cost
> 40 Sale cost
> 50 Manage cost
> 60 Telecom cost
>
> TABLE2:
> ACC_DATE ACC_NO AMT
> --------------------------------------------
> 960101 10 100
> 960101 20 200
> 960103 30 5000
> 960105 10 400
> 960109 50 1000
>
> How could I do for the result:
> ACC_NO ACC_NM TOTAL
> ---------------------------------------------------
> 10 Training cost 500
> 20 Traffic cost 200
> 30 Medical cost 5000
> 40 Sale cost
> 50 Manage cost 1000
> 60 Telecom cost
>
> Please give me some suggestions for the select statement,
> I'll very appriciate for your help!
> Please Cc to : violin.hsiao_at_mail.pouchen.com.tw,Thank you so much :)
>

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Wed Aug 12 1998 - 08:47:39 CDT

Original text of this message

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