我有以下声明:
select
product_name as ShortestLength = (select top 1 product_name, len(fact_name) Value_Length
from table
order by Value_Length, fact_name ASC)
返回此输出:
shortestlength
PS
我想将此结果添加到另一个选择语句中:
select
'Product' as Column_Name,
avg(case when product is null then 1.000 else 0 end) * 100 as PctMissing,
count(product) as TotalCount,
count(distinct product) as UniqueCount
from
table
所以结果将是:
列名 | 失踪 | 总数 | 唯一计数 | 最短长度 |
---|---|---|---|---|
产品 | 5.100 | 181186 | 15 | 附言 |
我应该在我的初始选择语句中添加什么?