У меня есть запрос, который я пытаюсь преобразовать в MySQL из MS SQL Server 2008. Он отлично работает на MSSQL, я получаю сообщение об ошибке " Incorrect parameter count in the call to native function 'ISNULL'
".
Как я могу это решить?
SELECT DISTINCT
dbo.'@EIM_PROCESS_DATA'.U_Tax_year,
dbo.'@EIM_PROCESS_DATA'.U_Employee_ID,
CASE
WHEN dbo.'@EIM_PROCESS_DATA'.U_PD_code = 'SYS033' THEN SUM(dbo.'@EIM_PROCESS_DATA'.U_Amount)
END AS PAYE,
CASE
WHEN dbo.'@EIM_PROCESS_DATA'.U_PD_code = 'SYS014' THEN SUM(dbo.'@EIM_PROCESS_DATA'.U_Amount)
END AS TOTALTAXABLE,
dbo.OADM.CompnyName,
dbo.OADM.CompnyAddr,
dbo.OADM.TaxIdNum,
dbo.OHEM.lastName + ', ' + ISNULL(dbo.OHEM.middleName, '') + '' + ISNULL(dbo.OHEM.firstName, '') AS EmployeeName
FROM
dbo.'@EIM_PROCESS_DATA'
INNER JOIN
dbo.OHEM ON dbo.'@EIM_PROCESS_DATA'.U_Employee_ID = dbo.OHEM.empID
CROSS JOIN
dbo.OADM
GROUP BY dbo.'@EIM_PROCESS_DATA'.U_Tax_year , dbo.'@EIM_PROCESS_DATA'.U_Employee_ID , dbo.OADM.CompnyName , dbo.OADM.CompnyAddr , dbo.OADM.TaxIdNum , dbo.OHEM.lastName , dbo.OHEM.firstName , dbo.OHEM.middleName , dbo.'@EIM_PROCESS_DATA'.U_PD_code
MySQL
SELECT DISTINCT
processdata.taxYear, processdata.empID,
CASE WHEN processdata.edCode = 'SYS033' THEN SUM (processdata.amount) END AS PAYE,
CASE WHEN processdata.edCode = 'SYS014' THEN SUM (processdata.amount) END AS TOTALTAXABLE,
company.companyName, company.streetAddress, company.companyPIN, employeemaster.lastName + ', ' + IFNULL(employeemaster.middleName, '')
+ ' ' + IFNULL(employeemaster.firstName, '') AS EmployeeName
FROM
processdata INNER JOIN
employeemaster ON processdata.empID = employeemaster.empID
CROSS JOIN company
GROUP BY processdata.taxYear, processdata.empID, company.companyName, company.streetAddress, company.companyPIN,
employeemaster.lastName, employeemaster.firstName, employeemaster.middleName, processdata.edCode