Mysql order by percent of two values sum -
so need order percent counted 2 values of 1 field data stored in json.
the field name values stored named program_invested_details
, example value is:
{"invested":"120.00","received":"1.08"}
i need $query
(received * 100 / invested)
field
select *, ($query) perrcent_total programs_list program_add_status = 4 , program_status = 1 order perrcent_total desc
how possible make?
by default mysql not have ability parse json string.
one option use extension such common_schema
add ability parse json , extract fields (see get_option
). not sure of performance hit take extension.
another option query data , parse json in client program. once again, there significant performance impact if there lot of data.
Comments
Post a Comment