不能与in查询一起使用

时间:2019-03-29 10:57:15

标签: mysql sql phpmyadmin

我有以下查询:

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”附近)

我该怎么办?

2 个答案:

答案 0 :(得分:1)

那是因为mysql中没有with运算符。

  

我该怎么办?

使用有效的语法

答案 1 :(得分:1)

您可以在下面尝试-

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