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

What is column?

716


What is synchronized subquery?

815


What is the use of prepared statement?

745


What type of database is cloud sql?

776


What is latest version of sql?

703






Differentiate between pl/sql and sql?

802


What is a rank in sql?

711


What is the life of an sql statement?

715


Can we update views in sql?

683


What is memory optimized?

743


How to avoid using cursors? What to use instead of cursor and in what cases to do so?

862


What are stuff and replace function?

768


what is the use of set statement in tsql? : Transact sql

732


What are different joins used in sql?

717


Explain mutating table error.

834