skip to Main Content

I have the following query:

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
    )
);

Which essentially apply specific condition, check here for more details, the problem’s that PhpMyAdmin seems not able to recognize with operator, infact I get:

Unrecognized statement type. (near “with” at position 0)

What can I do?

2

Answers


  1. That’s because there is no with operator in mysql.

    What can I do?

    Use valid syntax

    Login or Signup to reply.
  2. You can try below –

    select * 
        from match_case_1
        where round_id = 12696 and not exists(select * from match_case_1 where gameweek is null)
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search