1
I am creating this process to run once a day, as I have no experience, I got an error in the code below:
CREATE (definer omitido) PROCEDURE `MULTAOFF`()
BEGIN
set @multado = (select `CPFAluno` from multa where `dataMultaFim` <=
CURDATE());
update aluno set `StatusAluno` = '0' where @multado IN (`CPF`) and
StatusAluno = '2';
END
As a result of calling Call MULTAOFF();
I have the following error:
Error Code: 1242. Subquery returns more than 1 row
What’s going on and how I can fix it?
You’re trying to update Status, but you’re also indicating that the WHERE clause takes Status where the CPF and the student’s Status is 2, so you can’t update and use Where with the same field. Change your WHERE clause
– Victor