Hi All,

Hopefully you guys can help me out here. I'm really stumped. Here's the
situation.

I have 3 tables - clients, billing_client, and payments_clients. In
billing_client and payments_clients, I have the following fields ...

billing_client: id, client_id, amount, bill_desc
payments_clients: bill_id, client_id, payment_id, amount, pay_desc.

I want to get the value of total payments (payments_clients.amount) and the
total bills (billing_client.amount) along with the client contact
information I need to display.

I've managed to piece together a query that should work. Unfortunately,
Access doesn't like something I'm doing and multiplies the sum values by
14!! (Ie, if I'm supposed to get a 1, access returns 14)

I stripped down my query and was able to get access to return the right
value, but I don't see why this problem is happening in the first place.
Also, I don't get all the information I need with this stripped down query.


Thanks in advance!
- Jay

<!--- big query --->

<cfquery name="approved_info" datasource="#application.dsn#">
select sum(billing_client.amount) as billed, sum(payments_clients.amount) as
paid, client.org, client.client_id from billing_client,
payments_clients,client where billing_client.type = 'charge' and
billing_client.client_id = #client# and  billing_client.client_id =
client.client_id group by client.org, client.client_id </cfquery>

<!--- small query the returns the right sum value, but not all the info I
need --->

<cfquery name="approved_info" datasource="#application.dsn#">
select sum(billing_client.amount) as billed from billing_client where
billing_client.type = 'charge' and billing_client.client_id = #client#
</cfquery>



------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to