美文网首页
记录下laravel中的表别名

记录下laravel中的表别名

作者: LeeBoot | 来源:发表于2017-08-14 17:02 被阅读0次
    • 源码
                ->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中的表别名

          本文链接:https://www.haomeiwen.com/subject/gqnurxtx.html