我有一个SQL查询,它按Startdate对所有事件进行排序,我将startday定义为$today。
但此查询没有接受从YesStarDay开始,而endday是Tomorrow的事件。
如何在两者之间使用查询?
我的查询
SELECT * FROM wp_posts, `wp_mec_dates` AS mecd, wp_icl_translations WHERE wp_posts.ID = mecd.post_id and post_status=\'publish\' AND wp_icl_translations.language_code=\'$lang\' AND dstart>\'$startday\' and wp_posts.ID = wp_icl_translations.element_id ORDER BY dstart LIMIT 0,6
起始日期为$startday = date("Y-m-d");
编辑:使用文档(&W);救命,我现在在这里:
SELECT * FROM wp_posts, wp_mec_dates AS mecd, wp_icl_translations WHERE wp_posts.ID = mecd.post_id and post_status=\'publish\' AND wp_icl_translations.language_code=\'$lang\' AND ($startday BETWEEN dstart AND dend)AND wp_posts.ID = wp_icl_translations.element_id ORDER BY dstart LIMIT 0,6
但它返回0个结果。任何帮助都将不胜感激!