How to rewrite subquery to return only 1 row I need to somehow check if query result is NULL, MySQL returns error Subquery returns more than 1 row. How should I rewrite it in order to work correctly please?

SELECT DISTINCT user.id, user.username, user.name, user.surname, user.avatar,
(SELECT IF(ISNULL(
  (SELECT attendant.fk_user AS u
  FROM attendant
  WHERE fk_event = 1

  UNION

  SELECT organizer.fk_user AS u
  FROM organizer
  WHERE fk_event = 1

  UNION

  SELECT invitation.fk_user_to AS u
  FROM invitation
  WHERE fk_event = 1)), NULL, 1)) AS related
  ...
Change your subquery select to count(*) e.g.

select o.OrderID, o.OrderAmount
from Orders o
where (select count(id) from Disputes d where d.CustomerID = o.CustomerID) &lt;= 0