我有一个表master_t,其中包含customer_id和product_id以及flyer_section
我想算一下经常"回来"每个customer_id出现,到目前为止我有
proc sql
create table cust as
select
distinct customer_id
count((select(flyer_section from master_t where master_t.customer_id = distinct master_t.customer_id and flyer_section = 'back'))
from master_t
;
quit proc sql
我收到语法错误,我不确定它是否会起作用
谢谢。
答案 0 :(得分:0)
对于您的查询,不应该这样的工作吗?
create table cust as
select
customer_id
count(flyer_section) as BackCount
from master_t
where upper(flyer_section) = 'BACK'
or lower(flyer_section) = 'front'
or lower(flyer_section) = 'inside'
group by customer_id