I am new to teradata and I have written a simple query to extract sales and budget information from two tables. Initially the query resulted in the error 2616 - numeric overflow, post reading I have added the cast function.
The numbers from the output is stageringly high than what it is actually supposed to be, can you please assist in resolving this query.
If the query runs as expected, I am expecting the results as shown below
|201507||$ 13,869,499||$ 11,706,354||5,010,852|
however I am getting the results as below
|201507||$ 190,428,288||$ 2,774,403,528||64,756,723|
Hope this helps.
|201507||Hair Care||NON-FOODS||Health and Beauty Care||13617||2944|
|201507||Cooking Greens||FRESH/PERISHABLE||Fresh Produce||6776||4771|
|201507||Red Wine||PACKAGED BEVERAGES||Alcoholic Beverages||117497||13743|
|201507||Fruit Snacks||PACKAGED FOOD||Snacks||25198||13498|
Do you have 201507 multiple times in NW36_Category_Budget table? If so, the join you have is causing multiple records for same year week and in turn your sum gets shooted up.
Make sure you have only a one to one join