SELECT m.manufacturers_id, m.manufacturers_name,
op.products_price,
op.products_quantity,
p.products_cost.....
我有这些字段,我需要对结果执行 php 算术运算,但要根据它们的m.manufacturers_id
. 这是我需要或想要的结果格式。
Array(
[m.manufacturers_id]
[m.manufacturers_name]
[brands_total_sales ]
(sum of all the products_price * qty for the products in this manufacturers_id)
[products]
[0] =>
[op.products_price] = ''
[op.products_quantity] = ''
[p.products_cost] = ''
[1] =>
[op.products_price] = ''
[op.products_quantity] = ''
[p.products_cost] = ''
[2] =>
然后对每个 unique 的所有产品重复此操作manufacturers_id
。我想基本上问题是,是否有一个 php 函数来操作结果数组以“排序”或“分组”到manufacturers_id
在此先感谢,非常感谢您的帮助或建议。