June 15th, 2012, 07:52 AM
Insert and split currency in sub select
I wish to insert into a table using select, but I need to split a currency amount between the number of inserts for the select and where there is a balance leftover this needs to be justified to one of the inserts.
i.e divide 100 between 3 inserts
I currently do the following using PHP but it does not take care of the pennies.
tenants WHERE tenancy_id = 100 AND tt_rent_split > 0 AND tt_deleted = 0;
June 17th, 2012, 03:41 AM
This is the kind of logic that you need to keep outside MySQL in your procedural programming language (unless you want to write a stored procedure for it).