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
changes/01/9801/1
Kirill Solomko 9 years ago
parent fbf1f1438e
commit bb1690cccc

@ -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

Loading…
Cancel
Save