[freeside-users] Postgres query help?

Peter Bowen pbowen at corp.untd.com
Mon Jul 23 10:56:29 PDT 2007


Gerald,
    join with the cust_pkg table and check for cancel is null...  That will
weed them down more.

-Peter


On 7/22/07 11:41 AM, "Gerald V. Livingston II"
<gerald.freeside at sysmatrix.net> wrote:

> On Sun, 22 Jul 2007 11:38:05 -0500 (Central Standard Time) "Gerald V.
> Livingston II" <gerald.freeside at sysmatrix.net> wrote:
> 
>> freeside 1.5.8 running on a Debian Linux box. PostgreSQL 7.4.7
> 
>> I can't get my head wrapped around this one. I need to spit out a list of
>> customers who are set up for POSTAL billing. There was a problem during a
>> change of ownership at the business and I need to go through and reprint
>> their invoices for the last 3 months after crediting off any late fees that
>> were generated.
>> 
>> I got as far as 
>> 
>> SELECT cust_main.custnum WHERE cust_main_invoice.dest='POST'
>> 
>> But, that returns ALL of the old customers who no longer have active
>> packages and returns a row for each postal invoice that has ever been
>> generated for each customer. I just want a single customer number for each
>> active customer that is currently set to postal billing. Which table
>> indicates this for the WHERE portion of the query?
> 
> DUH!
> 
> SELECT cust_main_invoice.custnum WHERE cust_main_invoice.dest='POST'
> 
> returns only a single row for each custnum that has had a POST bill
> generated. The cancelled accounts are still there but the size of the
> returned list is much more manageable as we only have about 20 POST
> customers (including he cancelled ones).
> 
> Gerald
> _______________________________________________
> freeside-users mailing list
> freeside-users at sisd.com
> http://420.am/cgi-bin/mailman/listinfo/freeside-users



More information about the freeside-users mailing list