Adding a populated column to an existing table

2019-08-28 03:03发布

问题:

I have 2 table that have table counts in them. Something like Table 1:

New_Counts
100

Table 2:

Old_Counts
97

I want to create a single QC table so I can eventually check that the counts are increasing:

New_Counts|Old_Counts
100|97

Any ideas how to do this in SQL? A join won't work since the counts are never the same.

回答1:

select newcount,oldcount
from (select
    (select count(*) newcount from table1) newcount,
    (select count(*) oldcount from table2) oldcount
    from dual); 


标签: sql heidisql