left join t_trial_drive_shop ttds on ttds.created_by = tu.id
left join t_trial_drive_shop ttds on ttds.created_by = tu.id
left join t_electric_fence_copy tefc on tefc.fence_id = tef.id
left join t_electric_fence_copy tefc on tefc.fence_id = tef.id
left join (select * from t_approval where id in (select MAX(id) from t_approval group by biz_id,biz_type)) ta on ta.biz_id = tefc.id and ta.biz_type = 1
left join (select * from t_approval where id in (select MAX(id) from t_approval group by biz_id,biz_type)) ta on ta.biz_id = tefc.id and ta.biz_type = 1
where tef.del_flag = 0
where tef.del_flag = 0 and ttds.del_flag = 0
and tef.biz_fence_type = 12
and tef.biz_fence_type = 12
<iftest="term != null and term !=''">
<iftest="term != null and term !=''">
and (
and (
...
@@ -123,7 +123,7 @@
...
@@ -123,7 +123,7 @@
left join t_trial_drive_shop ttds on ttds.created_by = tu.id
left join t_trial_drive_shop ttds on ttds.created_by = tu.id
left join t_electric_fence_copy tefc on tefc.fence_id = tef.id
left join t_electric_fence_copy tefc on tefc.fence_id = tef.id
left join (select * from t_approval where id in (select MAX(id) from t_approval group by biz_id,biz_type)) ta on ta.biz_id = tefc.id and ta.biz_type = 1
left join (select * from t_approval where id in (select MAX(id) from t_approval group by biz_id,biz_type)) ta on ta.biz_id = tefc.id and ta.biz_type = 1