summaryrefslogtreecommitdiff
path: root/FS/FS/Misc
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-11-20 11:57:38 -0800
committerIvan Kohler <ivan@freeside.biz>2014-11-20 11:57:38 -0800
commit2d7110ecd22194c00aa81c798f9ca9056d9189dd (patch)
tree1af2e3d723c01e4b653e577b47b50841ae95f73d /FS/FS/Misc
parent5228e2f266bce7e42ad24179da3cddb563c687a0 (diff)
optimize
Diffstat (limited to 'FS/FS/Misc')
-rw-r--r--FS/FS/Misc/prune.pm16
1 files changed, 8 insertions, 8 deletions
diff --git a/FS/FS/Misc/prune.pm b/FS/FS/Misc/prune.pm
index 3f0c79d..ce72405 100644
--- a/FS/FS/Misc/prune.pm
+++ b/FS/FS/Misc/prune.pm
@@ -44,34 +44,34 @@ sub prune_applications {
my $ccr = <<EOW;
WHERE
- 0 = (select count(*) from cust_credit
+ NOT EXISTS (select 1 from cust_credit
where cust_credit_refund.crednum = cust_credit.crednum)
or
- 0 = (select count(*) from cust_refund
+ NOT EXISTS (select 1 from cust_refund
where cust_credit_refund.refundnum = cust_refund.refundnum)
EOW
my $ccb = <<EOW;
WHERE
- 0 = (select count(*) from cust_credit
+ NOT EXISTS (select 1 from cust_credit
where cust_credit_bill.crednum = cust_credit.crednum)
or
- 0 = (select count(*) from cust_bill
+ NOT EXISTS (select 1 from cust_bill
where cust_credit_bill.invnum = cust_bill.invnum)
EOW
my $cbp = <<EOW;
WHERE
- 0 = (select count(*) from cust_bill
+ NOT EXISTS (select 1 from cust_bill
where cust_bill_pay.invnum = cust_bill.invnum)
or
- 0 = (select count(*) from cust_pay
+ NOT EXISTS (select 1 from cust_pay
where cust_bill_pay.paynum = cust_pay.paynum)
EOW
my $cpr = <<EOW;
WHERE
- 0 = (select count(*) from cust_pay
+ NOT EXISTS (select 1 from cust_pay
where cust_pay_refund.paynum = cust_pay.paynum)
or
- 0 = (select count(*) from cust_refund
+ NOT EXISTS (select 1 from cust_refund
where cust_pay_refund.refundnum = cust_refund.refundnum)
EOW