0

Order および OrderProducts。注文テーブルの列 joinWith() を取得する方法。

      Order::find()
        ->select(['order.*'])
        ->joinWith(['orderProducts' => function($q){
                $q->select("order_id, product_id, product_name, product_price, quantity, CONCAT(order.currency, total_price) AS total_price");
            }])

上記のクエリでは、次のエラーが表示されます。

 SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order.currency' in 'field list'\nThe SQL being executed was: SELECT order.currency, id, CONCAT('http://192.168.1.114:1090/backend/web/images/products/',image) AS image, sku FROM `POS_1hj2gfru`.`product` WHERE `id`='3'"  
4

1 に答える 1