From 90f169ad8987a42eb97fbb9a039f3c40141bcc4d Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 1 Dec 2015 10:42:56 -0500 Subject: [PATCH] MT#16763 fix MySQL query to exclude already-processed resellers Change-Id: I9a435bae95f1ad162a34da2739733b818a353200 --- NGCP/CDR/Export.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NGCP/CDR/Export.pm b/NGCP/CDR/Export.pm index 1d89223..c5b08fe 100644 --- a/NGCP/CDR/Export.pm +++ b/NGCP/CDR/Export.pm @@ -61,9 +61,9 @@ sub get_reseller_name { sub get_missing_resellers { my ($dbh, $cids) = @_; - my $qs = 'select br.name, bc.id from billing.resellers br left join billing.contracts bc on br.contract_id = bc.id'; + my $qs = "select name, $reseller_id_col from billing.resellers"; if(@{ $cids }) { - $qs .= ' where bc.id not in (' . join (',', map { '?' }(1 .. @{ $cids }) ) . ")"; + $qs .= " where $reseller_id_col not in (" . join (',', map { '?' }(1 .. @{ $cids }) ) . ")"; } my $q = $dbh->prepare($qs); $q->execute(@{ $cids });