7596-devToTest_2426 #2600
|
@ -11,9 +11,9 @@ AS SELECT `e`.`truckFk` AS `id`,
|
|||
COUNT(DISTINCT `e`.`routeFk`) AS `routes`,
|
||||
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
|
||||
COUNT(DISTINCT `e`.`expeditionFk`) AS `expeditions`,
|
||||
sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) AS `fallos`,
|
||||
sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,
|
||||
max(`e`.`lastPacked`) AS `lastPacked`
|
||||
FROM `vn`.`expeditionCommon` `e`
|
||||
GROUP BY `e`.`truckFk`
|
||||
ORDER BY sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) DESC,
|
||||
ORDER BY sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) DESC,
|
||||
`e`.`eta`
|
||||
|
|
|
@ -7,12 +7,12 @@ AS SELECT `e`.`truckFk` AS `id`,
|
|||
`e`.`palletFk` AS `pallet`,
|
||||
COUNT(DISTINCT `e`.`routeFk`) AS `routes`,
|
||||
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
|
||||
COUNT(DISTINCT `e`.`roadmapStopFk`) AS `destinos`,
|
||||
sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) AS `fallos`,
|
||||
COUNT(DISTINCT `e`.`expeditionTruckFk`) AS `destinos`,
|
||||
sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,
|
||||
max(`e`.`lastPacked`) AS `lastPacked`
|
||||
FROM `vn`.`expeditionCommon` `e`
|
||||
GROUP BY `e`.`truckFk`,
|
||||
`e`.`palletFk`
|
||||
ORDER BY sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) DESC,
|
||||
ORDER BY sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) DESC,
|
||||
`e`.`eta`,
|
||||
`e`.`truckFk`
|
||||
|
|
|
@ -8,15 +8,15 @@ AS SELECT `e`.`truckFk` AS `id`,
|
|||
`e`.`routeFk` AS `route`,
|
||||
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
|
||||
`rs`.`description` AS `destinos`,
|
||||
sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) AS `fallos`,
|
||||
sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,
|
||||
`e`.`expeditionTruckFk` AS `expeditionTruckFk`,
|
||||
max(`e`.`lastPacked`) AS `lastPacked`
|
||||
FROM (
|
||||
`vn`.`expeditionCommon` `e`
|
||||
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `e`.`roadmapStopFk`)
|
||||
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `e`.`expeditionTruckFk`)
|
||||
)
|
||||
GROUP BY `e`.`truckFk`,
|
||||
`e`.`palletFk`,
|
||||
`e`.`routeFk`
|
||||
ORDER BY sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) DESC,
|
||||
ORDER BY sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) DESC,
|
||||
`e`.`palletFk`
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE vn.routesMonitor CHANGE expeditionTruckFk roadmapStopFk int(11) DEFAULT NULL NULL;
|
Loading…
Reference in New Issue