gpt4 book ai didi

mysql - 我该如何解决这个语法错误?

转载 作者:行者123 更新时间:2023-11-29 11:11:27 25 4
gpt4 key购买 nike

我正在尝试编写一个查询来提取电子邮件的客户数据。这是查询:

select
opp.*
from
(
select
opp.*,
row_number() over (partition by opp.contact_email_address order by opp.status_date desc) as row_number
from
opportunity_data opp
where
opp.site = 'wesellinsurance'
and opp.email_bounced = 'false'
and opp.email_unsubscribed = 'false'
and opp.first_mkt_medium not in ('partner', 'inbound_outbound')
and opp.latest_mkt_medium not in ('partner','inbound_outbound')
and opp.on_cover = 'false'
and opp.primary_group in ('market_trader', 'food_stand', 'mobile_food_van', 'caterer')
and opp.opportunity_status = ('quote_recieved','rfq_submitted', 'policy_expired_not_renewed')
and datediff(day, cast(latest_rfq_submitted_date as date),cast(getdate() as date)) > 30
and opp.lifecycle = 'new_business'
) opp
where row_number = 1

大多数语法分析器都说第 7 行有问题,但我似乎看不到它

最佳答案

第 18 行缺少 In

 select
opp.*
from
(
select
opp.*,
row_number() over (partition by opp.contact_email_address order by opp.status_date desc) as row_number
from
opportunity_data opp
where
opp.site = 'wesellinsurance'
and opp.email_bounced = 'false'
and opp.email_unsubscribed = 'false'
and opp.first_mkt_medium not in ('partner', 'inbound_outbound')
and opp.latest_mkt_medium not in ('partner','inbound_outbound')
and opp.on_cover = 'false'
and opp.primary_group in ('market_trader', 'food_stand', 'mobile_food_van', 'caterer')
and opp.opportunity_status in ('quote_recieved','rfq_submitted', 'policy_expired_not_renewed')
--------------^
and datediff(day, cast(latest_rfq_submitted_date as date),cast(getdate() as date)) > 30
and opp.lifecycle = 'new_business'
) opp
where row_number = 1

关于mysql - 我该如何解决这个语法错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40486548/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com