20 lines
635 B
SQL
20 lines
635 B
SQL
SELECT ep.id palletFk,
|
|
t.routeFk,
|
|
rs2.description truck,
|
|
r.description `zone`,
|
|
COUNT(es.id) labels,
|
|
t.warehouseFk warehouseFk,
|
|
dayname(r.dated) `dayName`,
|
|
rs.id <=> rm.roadmapStopFk isMatch
|
|
FROM vn.roadmapStop rs
|
|
JOIN vn.expeditionPallet ep ON ep.truckFk = rs.id
|
|
JOIN vn.expeditionScan es ON es.palletFk = ep.id
|
|
JOIN vn.expedition e ON e.id = es.expeditionFk
|
|
JOIN vn.ticket t ON t.id = e.ticketFk
|
|
JOIN vn.route r ON r.id = t.routeFk
|
|
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id
|
|
LEFT JOIN vn.roadmapStop rs2 ON rs2.id = rm.roadmapStopFk
|
|
WHERE ep.id = ?
|
|
GROUP BY ep.id, t.routeFk
|
|
ORDER BY t.routeFk
|