记录下laravel中的表别名

  • 源码
            ->leftJoin('product_specs as ps','c.product_specId','=','ps.id')
            ->where($where)
            ->select( DB::raw('c.product_specId,c.cart_id,p.id,p.name,p.tag_price,p.product_stock,p.is_spec,ps.spec_price,ps.spec_stock,p.photo,c.is_check,ps.spec_ids,c.cart_num') )
            ->toSql();
  • 输出格式:
"select c.product_specId,c.cart_id,p.id,p.name,p.tag_price,p.product_stock,p.is_spec,ps.spec_price,ps.spec_stock,p.photo,c.is_check,ps.spec_ids,c.cart_num from `carts` as `c` inner join `products` as `p` on `c`.`product_id` = `p`.`id` left join `product_specs` as `ps` on `c`.`product_specId` = `ps`.`id` where (`c`.`cart_id` = ?) ◀"

你可能感兴趣的:(记录下laravel中的表别名)