顺序
- 编号
- currency_code
- ex_rate_with_base
- 状态
- total_in_base_currency
- 状态
货币
- 货币代码
- 符号
- 货币名称
- currency_value
- ex_rate_with_base
- 状态
订单列表
- 编号
- 订单编号
- 产品代码
- 数量
- unit_price_in_base_currency
- 状态
我想要以下输出:
在这里,我想使用 Eloquent 将 order 表的 ex_rate_with_base
字段与 order_list 表的 unit_price
相乘。
最佳答案
我想你可以试试这个:
DB::table('order')
->select(DB::raw('(order.ex_rate_with_base * order_list.unit_price_in_base_currency) as orderRate'))
->leftjoin('order_list','order_list.order_id','=','order.id)
->get();
希望这对你有用!!!
关于php - 如何在 laravel 中用 Eloquent 方式将两个不同表中的两列相乘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45454138/