Carlos Iyu Carlos Iyu - 5 months ago 21
SQL Question

add two sql queries

How do I add two sql queries and result the final value of the second column ?

Example?

TABLE ONE

colum 1 | colum 2

10 | 5


RESULT:

TABLE ONE

colum 1 | colum 2

0 | 15


Query:

select colum 1 + colum 2 from TABLE ONE

Answer

Are you looking to update the rows with the squashed values?

UPDATE Table1 t1 SET t1.column2 = t1.column1 + t1.colum2, t1.column1 = 0;