Home > database >  With the UNION ALL can make a few data in a query not peers of the same column show the result set,
With the UNION ALL can make a few data in a query not peers of the same column show the result set,

Time:10-08

(select... )
UNION ALL
(select... )
UNION ALL
(select... )
The effect of this is

1
2
3


What do I want to achieve the different column

1 2 3


CodePudding user response:

Please post several specific fields, whether to need to collect, how many data, each sub queries you this post I can only give you the following query...

Select * from (select... ), a (select... B), (select... C)

CodePudding user response:

You can use the join
Select 1 from table1 a
Left the join
Select 2 from table1 b
On a.k ey=b.k ey
Left the join
Select 3 from table1 c
On a.k ey=c.k ey
Like this

CodePudding user response:

SELECT A. *, B., c. * FROM TABLE_A LEFT JOIN TABLE_B ON 1=1 LEFT JOIN TABLE_C ON 1=1 WHERE 1=1
  • Related