选择列表中的列“finance.revenue”无效,因为它不包含在聚合函数或 GROUP BY 子句中。
这是我的代码:
with footwear as (
select
description,
revenue
from
info i
inner join finance f on i.product_id = f.product_id
where
(description like '%shoe%'
or description like '%trainer%'
or description like '%foot%')
and description is not null
)
select
count(*) as num_of_products,
percentile_disc(0.5) within group (order by revenue) over() as median_clothing_revenue
from
info i
inner join finance f on i.product_id = f.product_id
where
i.description not in (select description from footwear);