Was wondering if anyone knows how to add up 4 columns in a query, give the
result a new column name, and then use that new column name in the WHERE
part of the query.

Situation is where some customers are 30, 60, 90 or 120 past due. So I'm
trying to add up the 30,60,90,120 column totals and save the result as a new
column called TOTALOUTSTANDING

Then we want to send emails to anyone where TOTALOUTSTANDING > 5   (where
the total outstanding is more than $5)

I tried this script, but the dang thing never worked:(

<CFQUERY NAME="pastduenotice" DATASOURCE="customers">
SELECT first_name, email_address, customer_number, total_due, (past_due_30)
+ (past_due_60) + (past_due_90) + (past_due_120) AS totaloutstanding
FROM accountsreceivable
where totaloutstanding > 0
</CFQUERY>

Appreciate any enlightenment on this one:)
______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to