简体   繁体   中英

Sybase SQL union of two different tables

Is it possible to make a union from two tables with different number of columns, values and column types in Sybase SQL?

Sure, as long as the columns from the top and bottom part of the union can be converted to the same type. For example:

select  intColumn as col1
,       charColumn as col2
,       decimalColumn as col3
from    Table1
union all
select  null
,       'Halelujah'
,       doubleColumn
from    Table2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM