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

What is spool space? Why do you get spool space errors? How do trouble-shoot them?

1041


What are default access rights in teradata?

1189


Difference between star and snowflake schemas?

1243


What is the use of teradata system software?

1088


Is it necessary to add? Quit statement after a bteq query when I am calling it in a unix environment?

1319


What is meant by a Clique?

1114


Why does varchar occupy 2 extra bytes?

1272


What are the advantages of teradata?

1059


Hi, If anyone has TD 14 Basics dumps or study materials, please share. nirmaaal1991@gmail.com

2470


Mention the procedure via which, we can run Teradata jobs in a UNIX environment.

1038


What are the joins in teradata and how many types of joins are there in teradata?

1055


While creating table my dba has fallback or no fallback in his ddl. What is that?

1241


What is meant by a Channel Driver?

1332


What is basic teradata query language?

1164


What are the scenarios in which full table scans occurs?

1052