0
我有两个表,其中一个计划另一个特定时间段的可用约会列表。我把时间基于日期(第一查询)的一周中的一天子查询比较不返回结果
select * from store_schedule where schedule_day = DATE_FORMAT('2011-01-17', '%a')
上述工作正常。
我从哪里获得任命的全部金额的日期和具体时间
SELECT count(*) from store_appointment a, store_schedule b
where a.store_schedule_id = b.id and apt_date = '2011-01-17'
在我来说,现在我在上2011/01/17在同一时间,这是两项任命第二查询准确地返回使用上述。
我在store_schedule中有一个名为concurrent_times的列来确定有多少约会可以在store_appointment中共享同一个store_schedule_id。以下是我的组合查询。
select * from store_schedule where
schedule_day = DATE_FORMAT('2011-01-17', '%a') AND
(SELECT count(*) from store_appointment a, store_schedule b
where a.store_schedule_id = b.id
and apt_date = '2011-01-17') < concurrent_appointments
由于某种原因,此查询返回零结果。任何人都可以看到我做错了什么?每个查询分解工作正常。