【发布时间】:2016-02-12 23:45:46
【问题描述】:
餐桌产品
productId type
1 A
2 A
3 A
4 B
5 B
6 C
我想要什么:
type perc
A 0.5
B 0.33
C 0.17
我们可以这样写一个简单的查询:
Select type, cnt/(select count(*) from product) AS perc
FROM (
select type, count(*) as cnt
from product
group by type
) nested
但是vertica不支持不相关的子选择
需要别人的帮助!
【问题讨论】:
-
您(现在已更改)查询对我来说很好(使用 Vertica 7.0)