我正在尝试创建一个查询,它将选择两个日期之间的所有日期
这是我的查询:
$query = "SELECT DISTINCT * FROM D1,D2
WHERE D1.DATE_ADDED BETWEEN '$date1' AND '$date2' AND D1.D1_ID = D2.D2_ID";
问题是,它没有返回任何东西,但也没有产生错误
所以我尝试像这样直接将它输入到phpMyAdmin中
SELECT DISTINCT * FROM D1,D2
WHERE D1.DATE_ADDED BETWEEN '2011-01-01' AND '2011-12-12'
AND D1.D1_ID = D2.D2_ID`
然后像这样
SELECT DISTINCT * FROM D1,D2
WHERE D1.DATE_ADDED BETWEEN '2011-01-01' AND '2011-12-12'
像这样
SELECT * FROM D1
WHERE DATE_ADDED BETWEEN '2011-01-01' AND '2011-12-12'
我只是得到
MySQL 返回一个空的结果集(即零行)。(查询耗时 0.0003 秒)
是的,我的表存在,列也存在 :)