在存储过程中,我有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个不同的组。
答案 0 :(得分:-1)
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