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
What are the available primary index types in teradata.
What is dimensional modeling?
What is a dimension table?
What is spool space? Why do you get spool space errors? How do trouble-shoot them?
Explain teradata vs. Redshift?
How to write the query . eid enm doj dob i want to display the names who worked more than 25 years .
What are the advantages of teradata?
Explain vproc in teradata?
What are the functions of a teradata dba?
There is a column with date in it. If I want to get just month how it can be done? Can I use sub string?
What is meant by Teradata Gateway?
What is the difference between global temporary tables and volatile temporary tables?
What are some commonly used bteq scripts?
What are the various etl tools in the market?
Hi send me the Teradata dumps to my id rajeshanantha@yahoo.co.in Thanks Rajesh. A