query fix
This commit is contained in:
@ -82,11 +82,13 @@ class ReportsController extends Controller
|
||||
),
|
||||
agg AS (
|
||||
SELECT
|
||||
COUNT(*) AS row_count,
|
||||
v.id,
|
||||
v.name,
|
||||
v.nopol1,
|
||||
vhc_id,
|
||||
trip_id,
|
||||
-- trip_id,
|
||||
ROW_NUMBER() OVER (PARTITION BY v.id ORDER BY MIN(a.crt_s)) AS trip_id,
|
||||
SUM(pre_milleage) AS mileage,
|
||||
MIN(a.crt_s) AS start,
|
||||
MAX(a.crt_s) AS finish,
|
||||
@ -100,6 +102,7 @@ class ReportsController extends Controller
|
||||
v.dlt is null and trip_id != 0
|
||||
and if(? , v.id = ? , 1=1)
|
||||
GROUP BY v.id, a.trip_id
|
||||
HAVING COUNT(*) > 1
|
||||
)
|
||||
SELECT
|
||||
*,
|
||||
|
||||
Reference in New Issue
Block a user