我有两个名为cases
,postings
的表。我想显示每周基本情况。还需要在发布时间到时从列表中删除一个案例。
以及下面给出的查询:
SELECT cases.CaseID,cases.CaseTitle,
max(postings.NextDate) NextDate1,max(postings.NextTime) NextTime1,
JOIN postings on postings.CaseID=cases.CaseID
WHERE cases.IsClosed=0 GROUP BY postings.CaseID
HAVING (NextDate1 >='2018-10-24' AND NextTime1 >='11:00:00' AND
NextDate1 <='2018-10-31') ORDER BY NextDate1,NextTime1
AND OUTOUT IS
CaseID CaseTitle NextDate
====== ========= ========
123 Test Case 24-10-2018 11:00 am
124 Test Case1 24-10-2018 02:00 pm
125 Test Case2 25-10-2018 11:00 am
案例表
CaseID CaseTitle
====== =========
123 Test Case
124 Test Case1
125 Test Case2
发布表
PostID CaseID NextDate NextTime
====== ====== ======== ========
11 123 24-10-2018 11:00 am
12 124 24-10-2018 02:00 pm
13 125 25-10-2018 11:00 am
当到达24日11:00 am caseid 123会自动从列表中删除