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 / shanmukh
SELECT STUDENTID, STUDENTNAME,
CASE WHEN SUBJECT1>SUBJECT2 AND SUBJECT1>SUBJECT3
THEN SUBJECT1 END AS SUBJECT1,
CASE WHEN SUBJECT2>SUBJECT1 AND SUBJECT2>SUBJECT3
THEN SUBJECT2 END AS SUBJECT2,
CASE WHEN SUBJECT3>SUBJECT1 AND SUBJECT3>SUBJECT2
THEN SUBJECT3 END AS SUBJECT3
FROM STUD1;
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Explain Teradata performance tuning and optimization?
What is meant by a Highest Cost Plan?
Explain the meaning of Amp?
What is a level of granularity of a fact table?
Did you write stored procedures in teradata?
Explain the advantages of partitioned primary index in a query?
What are the steps to create a data model?
What are the frequently used data types in teradata?
What are tpump utility limitations?
What do you mean by teradata intelliflex?
Highlight the advantages of PPI(Partition Primary Index).
What is meant by a dispatcher?
Why does varchar occupy 2 extra bytes?
What is the difference between teradata and basic rdbms?
How can you track login parameters of users in teradata?