Sorry, there is only 2 tables.  By referenced, I mean the following:

Table A
a_ID       cost
1          5
2          5

Table B
b_ID       cost_1        cost_2        a_ID
1          5             5             2
2          5             5             2

Expected Results:
For record 1 in Table A the Cost would be 5 and for record 2 the Cost
would be 20.

On Aug 23, 7:47 pm, ddf <orat...@msn.com> wrote:
> On Aug 23, 7:29 pm, Mark <markdanielmal...@gmail.com> wrote:
>
>
>
> > I need to translate the pseudo following into a SQL statement
>
> > 3 tables linked in a one to many relationship
>
> > Table A
> > a_ID
> > cost
>
> > Table B
> > b_ID
> > cost_1
> > cost_2
> > *a_ID
>
> > if Table A is referenced in Table B then
> >     return the sum (cost_1 + cost_2) from Table B of all the
> > referenced records
> > otherwise
> >     return cost from Table A
>
> What is the third table?  I see only two.
>
> Have you considered using a CASE statement for this?  Define what you
> mean by 'if Table A is referenced in Table B' because no one can help
> you without that information.
>
> David Fitzjarrell

-- 
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

Reply via email to