【发布时间】:2015-11-03 10:51:25
【问题描述】:
我想根据给定日期和 php mysql 中的治疗师 ID 从两个不同的列 (start_time,end_time) 中选择两个给定时间(start_time,end_time) 之间的数据。
我的数据库如下所示
appointment_id name age email appointment_date appointment_time appointment_endtime user_id therapist_id status
4 testing 25 notjitendra@mail.com 2015-11-03 01:00:00 02:00:00 2 12 SEND
3 testing 25 notjitendra@mail.com 2015-11-03 01:00:00 02:00:00 2 12 SEND
2 testing 25 notjitendra@mail.com 2015-11-03 01:00:00 02:00:00 2 12 SEND
1 testing 25 notjitendra@mail.com 2015-11-03 05:00:00 06:00:00 2 12 SEND
我正在尝试编写类似的查询
"SELECT therapist_id, appointment_time, appointment_endtime
FROM appointment
WHERE ((appointment_time BETWEEN '".$timee."' AND '".$end_time."' ) OR
(appointment_endtime BETWEEN '".$end_time."' AND '".$timee."') ) AND
therapist_id='".$_REQUEST['therapist_id']."' AND
appointment_date='".$_REQUEST['date']."'"
【问题讨论】:
-
“给我正确的解决方案” => 拜托?
-
"给我正确的解决方案" => 有人可以帮我走上正轨吗?
-
1.我可以阅读那些电子邮件地址。因此,如果他们真的很敏感,请考虑从您上传的任何位置删除该图像。 2. 见归一化。将客户信息存储在此表中显然是多余的。 3. 你并没有真正存储“年龄”,是吗? 4. 考虑将日期和时间存储为单个实体。效率更高。
标签: php mysql sql appointment