多年来,我一直在关注此声明,但是根本找不到错误,您能帮忙吗?

        SELECT XD.*, UhED.row_class,
            (SELECT id
                FROM Comment C
                WHERE C.Excel_Data_Excel_Lists_id = XD.Excel_Lists_id
                    AND C.Excel_Data_row = XD.row
                LIMIT 1
            ) AS has_activity
        FROM User_has_Excel_Lists UhXL
        JOIN Excel_Lists XL
            ON XL.id = UhXL.Excel_Lists_id
        JOIN Excel_Data XD
            ON XD.Excel_Lists_id = XL.id
        LEFT JOIN User_has_Excel_Data UhED
            ON UhED.Excel_Data_Excel_Lists_id = XL.id
                AND UhED.Excel_Data_row = XD.row
                AND UhED.User_id = 1
        WHERE UhXL.User_id = 1
            AND XL.created > DATE_SUB(DATE(now()), INTERVAL 2)<-- it says that the error is here
        GROUP BY XD.telephone
        ORDER BY last_name ASC, first_name ASC

最佳答案

 AND XL.created > DATE_SUB(DATE(now()), INTERVAL 2 DAY)


试试这个可能对你有帮助

关于mysql - SQL Date_Sub语法错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22630281/

10-12 15:38