Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以从中返回 2 个值?
我希望 HAVING 子句最多有两个。
$sql = mysql_query(" SELECT * FROM `Bill` WHERE ID_Number='12345' HAVING max(`Pay_Date`) ORDER BY `Pay_Date` DESC LIMIT 2");
您可以改为按 pay_date 订购结果。
$sql = mysql_query(" SELECT * FROM `Bill` WHERE ID_Number='12345' ORDER BY `Pay_Date` DESC LIMIT 2");
这应该有效,因为您将在 desc 中按 pay_date 对结果进行排序。命令。因此将显示最近的两个日期。