$query = "SELECT asset_id FROM #__content WHERE state = 1 AND YEARWEEK(publish_up) = YEARWEEK(NOW())";
使用此字符串,我可以在一星期内创建所有文章,但令人毛骨悚然的是,它从星期一到星期日都在计数,无论如何我都需要连续7天。
最佳答案
不确定这是否是您所要的。SELECT asset_id FROM #__content WHERE state = 1 AND DATE(publish_up) >= DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY)
关于mysql - 从MYSQL提取DATE,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14020404/