RT#23598: Feature Request - Email notice to A/R Report Results [now uses checkboxes...
[freeside.git] / bin / select-cust-desync_bill_dates.sql
1 SELECT DISTINCT custnum, agent_custid, first, last, company
2  FROM cust_pkg LEFT JOIN cust_main USING ( custnum )
3  WHERE cancel IS NULL AND 0 < (
4    SELECT COUNT(*) FROM cust_pkg AS others
5     WHERE cust_pkg.custnum = others.custnum
6       AND cust_pkg.pkgnum != others.pkgnum
7       AND cust_pkg.bill != others.bill
8       AND others.cancel IS NULL
9  );