Commit df91f0c4 authored by 周健威's avatar 周健威

修改查询bug

parent 3ce58ee4
......@@ -1289,8 +1289,8 @@
添加比较actual_start_date 和 actual_end_date-->
<!-- sevbr表:车辆联表预约记录,统计获得预约开始时间前最大预约记录时间、、预约结束时间后最小预约记录时间,过滤掉status != 4 and status != 6,和 -->
(select vehicle_id
, max(if(IFNULL(actual_end_date, book_end_date) &lt; #{startDateExtend}, IFNULL(actual_end_date,book_end_date), null)) as max_book_end_date
, min(if(IFNULL(actual_start_date, book_start_date) &gt; #{endDateExtend}, IFNULL(actual_start_date, book_start_date), null)) as min_book_start_date
, max(if(IFNULL(actual_end_date, book_end_date) &gt; #{startDateExtend}, IFNULL(actual_end_date,book_end_date), null)) as max_book_end_date
, min(if(IFNULL(actual_start_date, book_start_date) &lt; #{endDateExtend}, IFNULL(actual_start_date, book_start_date), null)) as min_book_start_date
from vehicle_book_record where status != 4 and status != 6 group by vehicle_id) sevbr
left join vehicle_book_record vbre
on sevbr.vehicle_id = vbre.vehicle_id and sevbr.max_book_end_date = IFNULL(vbre.actual_end_date, vbre.book_end_date) and vbre.status != 4 and vbre.status != 6
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment