i have a table like sales....the field are

Prodid Jan(jam month sales)Feb March apr may jun july

1 20 76 50 74 94 93 83
2 30 94 40 94 93 93 02
3 40 90 30 49 94 92 56
4 70 20 30 93 46 35 78
5 23 40 40 39 84 46 57
6 85 30 55 93 46 46 46
7 84 20 65 83 56 57 57
8 10 93 40 93 68 57 36
9 57 30 30 83 67 57 79
10 38 83 40 83 55 68 47
11 35 39 90 94 57 78 47
12 83 89 50 93 79 69 69
i wat ti find the max sales of every product which i want to
load into target table

Answer Posted / tdguy

Vaishnavi...i think the data presented here is already in a
reporting format...because sales amount for each month for
each prod id has been aggregated column wise. As far as I
know,any aggregate function like max,min,sum,count could
be applied only to row wise data. In case of manipulation
of column wise data, we may have to go with case statement
or we may have to transpose the column wise data to row
data for the manipulation to be done. So in this case,
either case statement has to be used for comparison of
column data or column to row transposition has to be done
by utilizing union statement(sel jan from table union sel
feb from table...till dec) and then the max value function
can be applied. Or if creation of volatile/temp tables is
allowed, then the above result can be stored temporarily
and manipulations can be done. Other option would be to
create UDF, but i think that has to be looped(thru SP i
think..not sure)...This is my opinion. Suggestions are
welcome.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by teradata sql assistant?

591


What are the multiload utility limitations?

595


Let us say there is a file that consists of 100 records out of which we need to skip the first and the last 20 records. What will the code snippet?

708


What are the commands to make a new table, change a table and remove a table in teradata?

614


What are the steps to create a data model?

602






What are the joins in teradata and how many types of joins are there in teradata?

573


How does hashing happens in teradata?

622


Briefly explain each of the following terms related to relational database management system (rdbms) – database, tables, columns, row, primary key and foreign key.

592


Which is more efficient group by or distinct to find duplicates?

646


What is meant by a Virtual Disk?

578


What is logical data model?

644


What is the use of teradata system software?

551


In a table can we use primary key in one column and in another column both unique and not null constrains.if yes how?

576


What is node? How many nodes and amps used in your previous project?

673


How to Extract data from multiple legacy systems?

576