[freeside-users] Postgres query help?

Gerald V. Livingston II gerald.freeside at sysmatrix.net
Sun Jul 22 09:38:05 PDT 2007

freeside 1.5.8 running on a Debian Linux box. PostgreSQL 7.4.7

(Plan to upgrade as soon as we get all customers imported from our legacy
billing system. Doing that by hand as our perl isn't up to par for using
the import template -- I have the import cgi working but can't get it to
populate the billing email address field or provision the services with the
username so it's easier to just copy/paste customers manually -- just slow)

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?



More information about the freeside-users mailing list