要求:查询出两列中不同值的总数 ,谢谢 列如a b (列名)1 22 31 48 219 11....要求:查询出两列中不同值的总数例子:a b s aa x结果为3 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 全部用SQL可以实现吗?不考虑代码?? 可以的,SELECT 第一列 AS '个数'FROM 表名UNIONSELECT 第二列FROM 表名ORDER BY '个数'COMPUTE COUNT(第一列) 那样会把a b s aa x变成结果为4 select count(distinct a)from(select a from tableunion allselect b from table) c leaohong(无定河) select count(distinct a)from(select a from tableunion allselect b from table) c 遍历控件取回值为空的TextBox控件 c# 有关用户权限设计问题(急) 新手提问 TextBox 下拉问题! httpwebrequest请求的问题 求在交换两个数字的值的代码中“+i+”的意思,为什么整个网络都没有答案:(,自己初学请各位老师解惑~ 请高手指点一下 在WebForm中如何用MediaPlayer9.0循环播放多首歌曲? 利用c#如何得到屏幕一点的颜色值 该用哪个函数? C#的类查找器在那里呢? c#怎么做一个桌面背景程序
SELECT 第一列 AS '个数'
FROM 表名
UNION
SELECT 第二列
FROM 表名
ORDER BY '个数'
COMPUTE COUNT(第一列)
a b
s a
a x
变成结果为4
from
(
select a from table
union all
select b from table
) c
select count(distinct a)
from
(
select a from table
union all
select b from table
) c