Question

I've been searching around for a bit now, but I haven't been able to find the solution yet, so I thought I'd ask here. I've got this query and it returns the 1241 error. What am I doing wrong?

SELECT  
            EMP_FORMAL,
            employee.EMP_ID,
            ROUND(ROUND(SUM(TIME_TO_SEC(TIMEDIFF(UREN_EIND,UREN_BEGIN))/3600),2)/(od_employee_extra.uren*0,4)*100, 2) AS SOM,
            ROUND(SUM(TIME_TO_SEC(TIMEDIFF(UREN_EIND,UREN_BEGIN))/3600),2) AS UREN,
            ROUND(SUM(TIME_TO_SEC(IF(IS_OPBON, TIMEDIFF(UREN_EIND,UREN_BEGIN), 0))/3600),2) AS FACTUUR_UREN,
            od_employee_extra.uren*0,4 AS TOTAAL_UREN,
            WEEK(UREN_DATUM,1) AS NUM
FROM 
            od_pc_common.urenreg

INNER JOIN 
            od_pc_common.employee ON (urenreg.EMP_ID = employee.EMP_ID)

INNER JOIN 
            od_common_settings.od_employee_extra ON (employee.EMP_ID = od_common_settings.od_employee_extra.EMP_ID AND employee.EMP_GROEP = od_employee_extra.EMP_GROUP)

WHERE 
           YEAR(UREN_DATUM) = 2014 AND 
           UREN_DATUM <= NOW() AND 
           employee.IS_ACTIVE = 1

GROUP BY 
           WEEK(UREN_DATUM, 1), 
           urenreg.EMP_ID

HAVING 
           NUM = 31;

ORDER BY 
           EMP_FORMAL ASC

Thanks in advance. ;)

EDIT: I just figured out what the problem was. The float numbers we're noted with a comma ("0,4"), whilst Sql syntax uses a dot ("0.4") instead.

Was it helpful?

Solution

My guess is about this line

od_employee_extra.uren*0,4 AS TOTAAL_UREN

Numbers in Sql are notated with a dot, not a comma.

Please check this line and use appropriate perantheis over here.

Also remove semicolon after Having

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top