join联表查询方法

$model = Shipping::join('shipping_area', 'shipping_area.shipping_id', '=', 'shipping.shipping_id')
           ->join('area_region', 'area_region.shipping_area_id', '=', 'shipping_area.shipping_area_id')
           ->whereIn('area_region.region_id', $region_id_list)
           ->where('shipping.enabled', 1)
           ->get();

 

 $model = self::select('goods.give_integral', 'order_goods.goods_price', 'order_goods.goods_number', 'goods.goods_id', 'order_goods.goods_id', 'goods.goods_name', 'order_goods.goods_attr')
                ->join('goods', 'goods.goods_id', '=', 'order_goods.goods_id')
                ->where('order_goods.order_id', $order_id)
                ->where('order_goods.goods_id', '>', 0)
                ->where('order_goods.parent_id', 0)
                ->where('order_goods.is_gift', 0)
                ->where('order_goods.extension_code', '<>', 'package_buy')
                ->get();

 

学习交流群:364976091
上一篇:Python3实现火车票查询工具


下一篇:druid监控配置