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
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / tdguy
Above answer is correct. Update statement would be the best
option (with case).
Update tablename
set mark3 = case when mark1>mark2
then mark1 else mark2 end;
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / rajesh
I didnt understand ur question,give me correct question and
excat o/p u wanted ,send example o/p what u wanted
Is This Answer Correct ? | 0 Yes | 1 No |
I Have Name field in a Table Name ------------- abcde;fgh;ijk; abc;def;jklm;no I want to write a sql to display name field data with out ';'.so i want to replace ; with '' how will write in Teradata
List out teradata data types?
List out some of the primary characteristics of teradata.
How can we check the version of Teradata that we are using currently?
Why teradata is used?
In which phase of the Active Data Warehouse evolution do you use data to determine what will happen?
whether Nulls will be counted while doing average? example: we have table column A with following values A -- 5 Null 8 3 Now what is the average of A?
What are the joins in teradata and how many types of joins are there in teradata?
Explain PDE.
1)WHAT IS THE EXACT DIFFERENCE BETWEEN TERADATA AND ORACLE? 2)MOST OF THE COMPANIES ARE USING TARA DATA FOR "DWH PROJECTS" ONLY? WHY?
6 Answers Bank Of America, Wipro,
What is a pseudo key? What is its use???
Can some one tell me the ressolution for the error. I was not able to answer this question in wipro interview. "The transaction exceeded the maximum number of rowhash locks allowed"