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...

Hi All,
I have a table with 3 fields like id,mark1,mark2 and I would
like to update a mark3 field that would calculate the max
for each record (so the max value of the 2 fields) in
Teradata
ID Mark1 Mark2 Mark3
1 10 20
2 20 30
3 40 10
4 50 50
I Have to write a update statement Mark3 with max value of
mark1,mark2 fields…like bellow
ID Mark1 Mark2 Mark3
1 10 20 20
2 20 30 30
3 40 10 40
4 50 50 50
Please any one help me ....Thq

Answer Posted / subbu

Hi NBK,

You can use the below UPD query to update the mark3 field
with maximum marks of Mark1 or Mark2 fields.

Update db_name.Tab_name
set mark3 = case
when mark1>mark2
then mark1
else mark2
end

Is This Answer Correct ?    13 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the functions performed by bynet?

1043


What is the opening step in basic teradata query script?

1042


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

1243


Difference between star and snowflake schemas?

1156


What is dimensional modeling?

1088


Can you fastexport a field, which is primary key by putting equality on that key?

1180


In general, how do you optimze any sql in teradata?

1043


What tools would you use for that?

1110


Highlight the differences between Primary Key and Primary Index.

1094


What is logical data model?

1210


Highlight a few of the important components of Teradata?

1030


What are the various indexes in teradata? How to use them? Why are they preferred?

1063


What is the use of fallback?

996


Explain fastload in teradata?

1111


How do you define Teradata?

1041