RE: [PHP-DB] SQL Guru Question:
don't think it won't work all in mysql... but what db are we talking about? Well, have you tried it like that? If that doesn't work you could try this: select @calc:=(round(pr_contents * 12)+ round(pr_buildings * 12)), (@calc * .33) as agent, (@calc * .5) as manager from pipeline Regards Joakim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SQL Guru Question:
Pete wrote: I'm trying to write a query to update the comission calculations on a database The sql looks something like select (round(pr_contents * 12)+ round(pr_buildings * 12)) *.33 as agent, (round(pr_contents * 12) + round(pr_buildings * 12)) * .5 as manager, from pipeline if there a way of having a "precalculated" field eg select (round(pr_contents * 12)+ round(pr_buildings * 12)) as calc, calc * .33 as agent, calc * .5 as manager, from pipeline Well, have you tried it like that? If that doesn't work you could try this: select @calc:=(round(pr_contents * 12)+ round(pr_buildings * 12)), (@calc * .33) as agent, (@calc * .5) as manager from pipeline Regards Joakim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] SQL Guru Question:
I'm trying to write a query to update the comission calculations on a database The sql looks something like select (round(pr_contents * 12)+ round(pr_buildings * 12)) *.33 as agent, (round(pr_contents * 12) + round(pr_buildings * 12)) * .5 as manager, from pipeline if there a way of having a "precalculated" field eg select (round(pr_contents * 12)+ round(pr_buildings * 12)) as calc, calc * .33 as agent, calc * .5 as manager, from pipeline tia pete -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php