Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Question about summing and joining

205376Jul 21 2004 — edited Jul 21 2004
Hi all

Still new to the whole SQL thing and I'm reaching for straws on a project I'm doing.

Background. I have 2 tables, tableA carries sales info for today only. TableB carries sales information for all previous days.

Both have EXACTLY the same columns, but in TableA the column ends in A and the same column ends in B. For example: In table B there is a column proddta.F554211B.SDGL and in table A the same column is proddta.F554211A.SDGL

I want to sum the sales in both tables so I would have F554211B.SDAEXP and F554211A.SDAEXP which would have sales for yesterday and today respectively. I had a sql statement that in part said:

Select Sum(proddta.F554211B.SDAEXP) AS SumOfSDAEXP, Sum(proddta.F554211A.SDAEXP) AS SumOfSDAEXP ....

Can I combine that into one sum because right now I get this hideously large number?

Also (and I'm reaching on this one) since ALL columns I'm calling are the same except for the A or B...is there a way to wildcard the column letter like this? (proddta.F554211*.SDAEXP) so the code is shorter?

Thanks for any help!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 18 2004
Added on Jul 21 2004
8 comments
328 views