$query = mysql_query(
"SELECT id, BuyerName,BuyerEmail,TransactionID,DateTime FROM `order`
WHERE DateTime="2015 AND 08""; LIMIT $start, $per_page"
)
or die(mysql_error());
我正在尝试使查询显示特定的月份和年份.
最佳答案 您可以使用MySQL的内置YEAR和MONTH函数,例如:
SELECT `id`, `BuyerName`,`BuyerEmail`,`TransactionID`,`DateTime`
FROM `order` WHERE YEAR(DATE(`DateTime`))=2015 AND MONTH(DATE(`DateTime`)) = 8