0 Replies Latest reply: Jun 11, 2018 11:59 AM by Mootaas Abu Baker RSS

    SQL statements is not working on load script editor

    Mootaas Abu Baker

      Hello everybody

       

      I am trying to upload a sql statement in the load script editor using Qlik sense Desktop. In my local machine using mysql Workbench the query is working. I'm getting always the following error.

      Error message.PNG

       

      I have also checked the time format settings

      Format.PNG

       

      The code i am using:

       

      SELECT

          SEC_TO_TIME(SUM(UNIX_TIMESTAMP(r.start_date) - UNIX_TIMESTAMP(s.end_date)) / (COUNT(CURDATE()))) AS Average,

          DATE_FORMAT(start_date, '%Y-%m-%d') AS DAY

      FROM

          db.table1 r,

          db.table2 s

      WHERE

          r.id = s.id

              AND TIMEDIFF(r.start_date, s.end_date) IS NOT NULL

      GROUP BY day

      ORDER BY start_date;

       

      start date and enddate are saved in datetimeformat. As you can see i'm groupping datetime value in a day value. I'm not sure if this is the probelm. If yes can anybody tell me how to fix this problem?