Question about summing and joining
205376Jul 21 2004 — edited Jul 21 2004Hi 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!