i have 2 table table one 4 columns respective values a1
7,a2 6,a3 8 ,a4 12 & table two 4 colums respective values
a1 7,a2 6,a3 8,a4 15.if table one & table two 3 colums same
then 4th column values 1)Qes diff >5 then print 5 * diff
value 2)Que diff <5 print 5

Answer Posted / anithaletchumi

select t1.name,case when abs(t1.val-t2.val) > 5 then 5 *
abs(t1.val - t2.val) else 5 end diff from tab1 t1 join tab2 t2
on t1.name=t2.name where t1.val != t2.val

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how are mysql timestamps seen to a user? : Sql dba

562


how to rename an existing column in a table? : Sql dba

510


how to present a past time in hours, minutes and seconds? : Sql dba

559


What is partition by in sql?

569


Write a unique difference between a function and a stored procedure.

530






What is sql stand for?

573


define join and explain different type of joins? : Sql dba

545


What is left join in sql?

582


What is consistency?

713


how to install mysql? : Sql dba

580


Can you join a table to itself?

541


What is the use of sql trace?

476


Does execute immediate commit?

699


What do we need to check in database testing?

554


Why do we use triggers?

520