Posts /

MySQL Error 1093

05 Mar 2018

Error

Error Example

DELETE
FROM room
WHERE idx IN (
  SELECT DISTINCT R.id as idx
  FROM room R
  LEFT JOIN groups G ON R.id=G.rid
  WHERE isnull(G.rid)
)

Handling

DELETE
FROM room
WHERE idx IN (
  SELECT idx
  FROM (
    SELECT DISTINCT R.id as idx
    FROM room R
    LEFT JOIN groups G ON R.id=G.rid
    WHERE isnull(G.rid)
  ) temp
);

Twitter Facebook Google+