Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Hi send me the Teradata dumps to my id rajeshanantha@yahoo.co.in Thanks Rajesh. A

3360


What are the various indexes in teradata? Why are they preferred?

991


What is logical data model?

1187


What is the opening step in basic teradata query script?

1024


What is meant by a Virtual Disk?

1115


What exactly do you know about catching in teradata?

1024


What do you mean by teradata intellicloud?

1023


Explain how spool space is used.

1060


What is the difference between global temporary tables and volatile temporary tables?

1152


Can you connect multiload from ab initio?

1199


Difference between inner join and outer join?

1003


How is MLOAD Client System restarted after execution?

1123


What are the 5 phases in a multiload utility?

1020


List out all forms of LOCKS that are available in Teradata.

952


Explain the term 'columns' related to relational database management system?

1047