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
Hi send me the Teradata dumps to my id rajeshanantha@yahoo.co.in Thanks Rajesh. A
What are the various indexes in teradata? Why are they preferred?
What is logical data model?
What is the opening step in basic teradata query script?
What is meant by a Virtual Disk?
What exactly do you know about catching in teradata?
What do you mean by teradata intellicloud?
Explain how spool space is used.
What is the difference between global temporary tables and volatile temporary tables?
Can you connect multiload from ab initio?
Difference between inner join and outer join?
How is MLOAD Client System restarted after execution?
What are the 5 phases in a multiload utility?
List out all forms of LOCKS that are available in Teradata.
Explain the term 'columns' related to relational database management system?