SQL完全连接没有任何条件

我正在使用MS sql.
我有以下表格:
table A:
    id1   data1
    8234    ko
    2       po
    333     koo
    40      woo

table B:
    id2     data2
    123     meow
    654     frrr

table C:
    id3     data3
    10          a
    20          b
    30          c
    40          d
    50          e   
    60          f

我想得到这个:

id1     data1       id2     data2       id3     data3
    8234    ko          123      meow        10         a
    2       po          654      frrr        20         b
    333     koo         NULL     NULL        30         c
    40      woo         NULL     NULL        40         d
    NULL    NULL        NULL     NULL        50         e
    NULL    NULL        NULL     NULL        60         f

这似乎是没有任何条件的全部表格.我只是希望得到所有表中的所有列和所有数据.我怎么能这样做?
UPD:表格不相关.
如果表是相关的:当事先知道哪个表大于表时,我会使用LEFT或RIGHT JOIN.但它不得而知.

解决方法

使用row_number创建索引以用于完整连接
select * from (
    select 
        row_number() over (order by id1 asc) rn,id1,data1
    from ta
) t1    
full join (
    select 
        row_number() over (order by id2 asc) rn,id2,data2
    from tb
) t2 on t1.rn = t2.rn
full join (
    select 
        row_number() over (order by id3 asc) rn,id3,data3
    from tc
) t3 on t1.rn = t3.rn

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...