Fix: Fix SQL GROUP BY error in daily/hourly summary aggregation - Use COALESCE in GROUP BY to handle NULL tariff amounts - Remove invalid is_active check on tariffs table
This commit is contained in:
@@ -58,7 +58,7 @@ class DailySummaryService
|
|||||||
e.location_code,
|
e.location_code,
|
||||||
e.gate_code,
|
e.gate_code,
|
||||||
e.category,
|
e.category,
|
||||||
t.amount
|
COALESCE(t.amount, 0)
|
||||||
";
|
";
|
||||||
|
|
||||||
$stmt = $this->db->prepare($sql);
|
$stmt = $this->db->prepare($sql);
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ class HourlySummaryService
|
|||||||
LEFT JOIN tariffs t ON e.location_code = t.location_code
|
LEFT JOIN tariffs t ON e.location_code = t.location_code
|
||||||
AND e.gate_code = t.gate_code
|
AND e.gate_code = t.gate_code
|
||||||
AND e.category = t.category
|
AND e.category = t.category
|
||||||
AND t.is_active = 1
|
|
||||||
WHERE DATE(e.event_time) = ?
|
WHERE DATE(e.event_time) = ?
|
||||||
GROUP BY
|
GROUP BY
|
||||||
DATE(e.event_time),
|
DATE(e.event_time),
|
||||||
@@ -62,7 +61,7 @@ class HourlySummaryService
|
|||||||
e.location_code,
|
e.location_code,
|
||||||
e.gate_code,
|
e.gate_code,
|
||||||
e.category,
|
e.category,
|
||||||
t.amount
|
COALESCE(t.amount, 0)
|
||||||
";
|
";
|
||||||
|
|
||||||
$stmt = $this->db->prepare($sql);
|
$stmt = $this->db->prepare($sql);
|
||||||
|
|||||||
Reference in New Issue
Block a user