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 different functions performed in development phase?

578


What are the different methods ot loading a dimension table? A fact table etc?

578


What is oltp?

574


Explain teradata architecture?

638


How do you define Teradata?

612






What are the available primary index types in teradata.

591


Steps to create a data model?

666


What are the different functions included in the server software?

607


Explain some differences between mpp and smp?

596


In a table can we use primary key in one column and in another column both unique and not null constrains.if yes how?

580


Give the sizes of SMALLINT, BYTEINT and INTEGER.

668


How do you set the session mode parameters in bteq?

615


What are the 5 phases in a multiload utility?

617


What is the difference between teradata and basic rdbms?

570


Which is faster fastload or multiload?

600