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

Prodid Jan(jam month sales)Feb March

1 20 76 50
2 30 94 40
3 40 90 30
4 70 20 30
5 23 40 40
6 85 30 55
7 84 20 65
8 10 93 40
9 57 30 30
10 38 83 40
11 35 39 90
12 83 89 50
Now the Question is i want get the max sales of 12 products
from the months.hint:for eg I WANT GET 89 for product12...

Can any one help me

Answer Posted / naga

sel t.p,t.jan1, t.col_nm
from (

select p,jan1,'jan1' as col_nm from pm1
union
select p,feb1,'feb1' from pm1
union
select p,mar,'mar' from pm1
)t
qualify rank () over(partition by p order by jan1 desc) =1 order by p;

its bit lengthy but not a complex one..I just
added extra col as col_nm to identify the month name

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain teradata utilities. What is multiload, fast load, tpump?

575


My table got locked during mload due to a failed job. What do I do to perform other operations on it?

683


Can you connect multiload from ab initio?

645


Comment whether bottleneck is an error or not.

625


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

673






What do you mean by tpt in teradata?

593


What is the maximum number of dml can be coded in a multiload script?

621


Highlight a few of the important components of Teradata?

586


What is meant by a Least Cost Plan?

624


How many tables can you join in v2r5?

626


What are the steps to create a data model?

602


What are default access rights in teradata?

628


What are the different softwares used with their functions in teradata?

577


why use references rather than pointers in the public api, particularly for arguments which are modified?

557


if collect stats but it show low confidence why?

1192