我有以下查询:
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
运算符,事实上我得到:
Unrecognized statement type. (near "with" at position 0)
我能做什么?
最佳答案
您可以尝试以下 -
select *
from match_case_1
where round_id = 12696 and not exists(select * from match_case_1 where gameweek is null)
关于mysql - 不能在查询中使用with,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55415921/