i have column like below
studentid studentname sub1 sub2 sub3
1 aaa 40 70 90
2 bbb 60 80 50
i want to execute every student highest mark in which subject
my o/p like below
studentid studentname sub3 sub2
1 aaa 90
2 bbb 80
Answer Posted / mahesh raja
SEL STUDENTID,STUDENTNAME,MARKS, SBJ,RANK()OVER (PARTITION
BY STUDENTID ORDER BY MARKS DESC ) AS RANK1 FROM
(
SEL STUDENTID,STUDENTNAME,SUBJECT1 AS MARKS, 'SUB1' AS SBJ
FROM STUD1
UNION
SEL STUDENTID,STUDENTNAME,SUBJECT2 AS MARKS, 'SUB2' AS SBJ
FROM STUD1
UNION
SEL STUDENTID,STUDENTNAME,SUBJECT3 AS MARKS, 'SUB3' AS SBJ
FROM STUD1
)A QUALIFY RANK1=1
| Is This Answer Correct ? | 9 Yes | 0 No |
Post New Answer View All Answers
what is object level locking ? where do appear this type of locking ?
What do you mean by teradata intellicloud?
How to explain project Architecture and flow in teradata interviews?Can please anyone help on this? Am new to teradata.
List out some of the primary characteristics of teradata.
How many sessions of MAX is PE capable of handling at a particular time?
Explain amp in teradata?
Explain the teradata primary index mechanics in detail with a diagram.
what is sysdba and sysdbc ? which has high priority ?
Highlight the advantages of PPI(Partition Primary Index).
Explain Teradata performance tuning and optimization?
why use references rather than pointers in the public api, particularly for arguments which are modified?
how many modules are there in telecome domain?how to explain the architecture?
If Fast Load Script fails and only the error tables are made available to you, then how will you restart?
What are the updated features of teradata?
What is a dimension table?