在存储过程中,我有 value1, value2, value3, ..., value8
价值结果将在 A 和 F 之间。
将值存储到变量中后,有没有办法查看 value1~8 中存储了多少不同的值?
example)
value1 = F; value2 = A; value3 = B; value4 = B;
value5 = B; value6 = D; value7 = D; value8 = F;
然后在我的计数(不同 *)之后,结果应该是 4 个不同的组。
在存储过程中,我有 value1, value2, value3, ..., value8
价值结果将在 A 和 F 之间。
将值存储到变量中后,有没有办法查看 value1~8 中存储了多少不同的值?
example)
value1 = F; value2 = A; value3 = B; value4 = B;
value5 = B; value6 = D; value7 = D; value8 = F;
然后在我的计数(不同 *)之后,结果应该是 4 个不同的组。
select Value, COUNT(*) from (
select value1 as Value from sometable
union all
select value2 as Value from sometable
union all
select value3 as Value from sometable
union all
select value4 as Value from sometable
union all
select value5 as Value from sometable
union all
select value6 as Value from sometable
union all
select value7 as Value from sometable
union all
select value8 as Value from sometable) as SomeTable
group by Value