我有以下查询:

with current_round as (
select *
from match_case_1
where round_id = 12696
)
select *
from current_round cr
where
(
    not exists(select * from current_round where gameweek is null)
)
or
(
    exists(select * from current_round where status = 1)
    and not exists(select * from current_round where gameweek is not null)
    and cr.status = 1
)
or
(
    not exists(select * from current_round where status = 1)
    and not exists(select * from current_round where gameweek is not null)
    and cast(cr.`datetime` as date) = (
        select max(cast(`datetime` as date)) as `date`
        from current_round
        where status = 5 or status = 3
    )
);


实际上,这适用于特定条件,请检查here以获得更多详细信息,问题是PhpMyAdmin似乎无法识别with运算符,实际上我得到了:


  无法识别的语句类型。 (在位置0处的“ with”附近)


我能做什么?

最佳答案

您可以在下面尝试-

select *
    from match_case_1
    where round_id = 12696 and not exists(select * from match_case_1 where gameweek is null)

关于mysql - 不能与in查询一起使用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55415921/

10-10 00:53
查看更多