sql server - Correct way to perform Sql self union -


let's have table below:

table1:  **t1**   **t2**   **t3**  abc       xyz      aaa 

can like:

select * from( (select t.t1,t.t2,t.t3 table1 t) tmp union (select tmp2.t1,'someothervalue' t2,tmp2.t3 tmp tmp2)) result order result.t1 

basically union operation first tmp table itself. let's t1,t2,t3 of varchar type.

from tmp tmp2 not possible instead of use from table1 tmp2, updated sql query

select * from(      select t.t1,t.t2,t.t3 table1 t union      select tmp2.t1,'someothervalue' t2,tmp2.t3 table1 tmp2 ) result order result.t1 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -