From bb1690ccccea2a7ed0d2ce1434968fdc3bad91a6 Mon Sep 17 00:00:00 2001 From: Kirill Solomko Date: Thu, 24 Nov 2016 12:27:43 +0100 Subject: [PATCH] TT#7169 fix contract_fraud_events virtual sql * GROUP only by contract_id in the billing_mapping INNER JOIN to have only 1 record per contract_id with the most recent start_time - (if there is only one record with NULL start_time (the default one) it is properly fetched Change-Id: I0d312eb6685d109e99affd91249ae312d919a59d --- lib/NGCP/Schema/Result/contract_fraud_events.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/NGCP/Schema/Result/contract_fraud_events.pm b/lib/NGCP/Schema/Result/contract_fraud_events.pm index 3a56b334..bc0baff4 100644 --- a/lib/NGCP/Schema/Result/contract_fraud_events.pm +++ b/lib/NGCP/Schema/Result/contract_fraud_events.pm @@ -124,7 +124,7 @@ FROM ( FROM billing.billing_mappings m WHERE (m.start_date IS NULL OR m.start_date <= NOW()) AND (m.end_date IS NULL OR m.end_date >= NOW()) - GROUP BY 1, 2 + GROUP BY 1 ) bm ON bm.contract_id = c.id JOIN billing.billing_profiles bp ON bp.id = bm.billing_profile_id JOIN billing.contacts n ON n.id = c.contact_id