[英]Using WITH in MonetDB
I'm trying to execute the next query in MonetDB using "WITH":我正在尝试使用“WITH”在 MonetDB 中执行下一个查询:
with a as (select data_string from colombia.dim_tempo)
select
t.ano_mes
,f.sg_estado
,f.cod_produto
, sum(f.qtd_vendidas) as qtd_vendidas
, count(*) as fact_count
from colombia.fact_retail_market f, colombia.dim_tempo t
where f.cod_anomes = t.data_string
and t.data_string in (a.data_string)
group by
t.ano_mes
,f.sg_estado
,f.cod_produto ;
But always get this message:但总是收到这条消息:
What's wrong with the sentence?句子有什么问题?
The WHERE
clause needs to be: WHERE
子句需要是:
WHERE f.cod_anomes = t.data_string AND
t.data_string IN (SELECT data_string FROM a)
That is, IN
needs to be followed by a subquery against the CTE.也就是说,
IN
后面需要跟一个针对 CTE 的子查询。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.