
    SELECT 
        `user_details`.`user_id` AS `user_id`,
        IFNULL(`user_answersToDay`.`AnswerToDay`, 0) AS `answerToDay`,
         IFNULL(`user_answersToDay`.`avgToDay`, 0) AS `avgToDay`,
        IFNULL(`user_answersToDay`.`AnswerToDay1`, 0) AS `answerToDay1`,
        IFNULL(`user_answersToDay`.`AnswerToDay2`, 0) AS `answerToDay2`,
        IFNULL(`user_answersToDay`.`AnswerToDay3`, 0) AS `answerToDay3`,
        IFNULL(`user_noAnswerToDay`.`noAnswerToDay`, 0) AS `noAnswerToDay`
    FROM
        (select '{user_id}' as user_id) user_details
        LEFT JOIN (SELECT 
            `replog_data`.`user_id` AS `user_id`,
                sum(case when `replog_data`.`Grade` < 4 then 1 else 0 end) AS `AnswerToDay`,
                avg(case when `replog_data`.`Grade` < 4 then `replog_data`.`Grade` else 0 end) AS `avgToDay`,
                sum(case when `replog_data`.`Grade` = 1 then 1 else 0 end) AS `AnswerToDay1`,
                 sum(case when `replog_data`.`Grade` = 2 then 1 else 0 end) AS `AnswerToDay2`,
                  sum(case when `replog_data`.`Grade` = 3 then 1 else 0 end) AS `AnswerToDay3`
        FROM
            `replog_data`
        WHERE
          `replog_data`.`date` = CAST((NOW() + INTERVAL -(5) HOUR) AS DATE) and user_id = '{user_id}'
        ) `user_answersToDay` ON `user_details`.`user_id` = `user_answersToDay`.`user_id`
        
         LEFT JOIN (SELECT 
            `cards_data_base`.`user_id` AS `user_id`,
                COUNT(`cards_data_base`.`card_id`) AS `noAnswerToDay`
        FROM
            `cards_data_base`
        WHERE
            (Repetition and user_id = '{user_id}')
        GROUP BY `cards_data_base`.`user_id`) `user_noAnswerToDay` ON `user_details`.`user_id` = `user_noAnswerToDay`.`user_id`
