Welcome Guest, Not a member yet? Register   Sign In
Need help with an SQL query
#3

[eluser]Nick Woodhead[/eluser]
Hi Sorry about that I did mean property_id I was playing around with different ways of trying to do it and didn't realize I had left that in there.

I did run last_query sorry I didn't post that info.

SELECT COUNT(active_properties.fla_id) AS total_flas, COUNT(purchase_agreements.purchase_agreement_id) AS executed_flas, SUM(purchase_agreements.sale_price*listing_agreements.commission_rate) AS total_commission FROM (`active_properties`) LEFT JOIN `listing_agreements` ON `listing_agreements`.`fla_id` = `active_properties`.`fla_id` LEFT JOIN `purchase_agreements` ON `purchase_agreements`.`fla_id` = `active_properties`.`fla_id` WHERE `active_properties`.`agent_id` = 16 GROUP BY `active_properties`.`property_id`


I ended up just going with 2 db queries for now and getting the right info that way but I hate when I can't get something to work.

Thanks for taking a look.


Messages In This Thread
Need help with an SQL query - by El Forum - 08-09-2011, 03:59 PM
Need help with an SQL query - by El Forum - 08-10-2011, 05:30 AM
Need help with an SQL query - by El Forum - 08-10-2011, 09:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB