我有查询:
SELECT * FROM members ORDER BY ( firstColumn / anotherColumn ) DESC
现在,我正在打印此:
return $query['firstColumn'] / $query['anotherColumn'];
是否有可能在没有任何php技巧的情况下打印除法结果?例如
return $query['dividedColumns'];
最佳答案
列别名将解决您的问题,您可以将查询更改为:
SELECT members.*,
( firstColumn / anotherColumn ) AS `divided_amount`
FROM members
ORDER BY divived_amount DESC;