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