summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorivan <ivan>2010-08-25 23:15:30 +0000
committerivan <ivan>2010-08-25 23:15:30 +0000
commit9f8fcbc5c678e168327086db8c362c52eb22f74b (patch)
treee4ad9c22367635410b8dd4ccadb78bd94e88521f /bin
parentd37e29db87490cba5793a0db5121b7b6010feef0 (diff)
quick query on desynced bill dates, RT#9733
Diffstat (limited to 'bin')
-rw-r--r--bin/select-cust-desync_bill_dates.sql9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/select-cust-desync_bill_dates.sql b/bin/select-cust-desync_bill_dates.sql
new file mode 100644
index 000000000..5506f90ed
--- /dev/null
+++ b/bin/select-cust-desync_bill_dates.sql
@@ -0,0 +1,9 @@
+SELECT DISTINCT custnum, agent_custid, first, last, company
+ FROM cust_pkg LEFT JOIN cust_main USING ( custnum )
+ WHERE cancel IS NULL AND 0 < (
+ SELECT COUNT(*) FROM cust_pkg AS others
+ WHERE cust_pkg.custnum = others.custnum
+ AND cust_pkg.pkgnum != others.pkgnum
+ AND cust_pkg.bill != others.bill
+ AND others.cancel IS NULL
+ );