Answer the question
In order to leave comments, you need to log in
How to fix syntax error?
The whole task sounds like this:
It is necessary to draw up a "Payroll" (salary-13%). If there are minor children, one minimum wage is not taxed.
Employees
Children
Positions: The
catch is that it is not possible to check the age of majority of the eldest child.
case when ( year(now()) - year(select Дети.birth from Дети,Сотрудники where Сотрудники.pers_number = Дети.pers_number_parr order by Дети.birth limit 1)<=18) then
select pers_number,fio,
case when ( year(now()) - year(select Дети.birth from Дети,Сотрудники where Сотрудники.pers_number = Дети.pers_number_parr order by Дети.birth limit 1)<=18) then
0.87*(select salary from Должности where Должности.name_pos=Сотрудники.position)-0.13*5965 else
(
(select salary from Должности where Должности.name_pos=Сотрудники.position)*0.87
)
end as salary
from Сотрудники;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where year(now()) - year(select Дети.birth from Дети,Сотрудник' at line 2
Answer the question
In order to leave comments, you need to log in
well, firstly, in the second query, select pers_number, fio, the comma is superfluous
Well, he swears correctly, read the case documentation . You need an if, on the same page.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question