The following query seems to only work when there is one single entry with dateOfBirth
set to 1975-02-28
.
It fails when there are multiple records matching this condition.
Is it possible to delete all the addresses of users whose attribute dateOfBirth
is set to 1975-02-28
without using a subquery?
SELECT @id:=(SELECT id
FROM USER
WHERE dateOfBirth='1975-02-28');
DELETE FROM Address
WHERE user_id=@id;
The exact error that I get is: Error Code: 1242 Subquery returns more than 1 row.
.