将填充的列添加到现有表 [英] Adding a populated column to an existing table

查看:98
本文介绍了将填充的列添加到现有表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2张桌子,里面有桌子数.就像是 表1:

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

New_Counts
100

表2:

Old_Counts
97

我想创建一个QC表,以便最终检查计数是否在增加:

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

New_Counts|Old_Counts
100|97

有什么主意如何在SQL中做到这一点?联接不会起作用,因为计数永远不会相同.

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

推荐答案

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

这篇关于将填充的列添加到现有表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆