如何从mysql数据库中选择当前日期和明天的日期数据

时间:2012-04-09 07:00:44

标签: php mysql

我有一个数据库我想只从当前日期的数据库中选择数据,之后为tommorrows日期

$query = mysql_query("SELECT      PatientMaster.PatientFirstName,PatientMaster.PatientLastName,PatientMaster.PatientID,ProviderAppointmentListings.ProviderNPI,ProviderAppointmentListings.AppointmentTime,ProviderAppointmentListings.AppointmentListingsID, '' FROM PatientMaster JOIN ProviderAppointmentListings ON PatientMaster.PatientID = ProviderAppointmentListings.PatientId LIMIT 0, 30");



$rows = array();
while($row = mysql_fetch_assoc($query)) {
$rows[] = $row;
}
echo json_encode($rows);

2 个答案:

答案 0 :(得分:1)

WHERE YOUR_DATE_FIELD=CURDATE() or YOUR_DATE_FIELD=CURDATE()+ INTERVAL 1 DAY

答案 1 :(得分:0)

SELECT * FROM tablename TO_DAYS(NOW())和TO_DAYS(NOW())之间的WHERE TO_DAYS(列名)+ 1