$res2 = M(‘stat_info a‘)
->join(C(‘DB_PREFIX‘).‘stock b ON a.goods_id = b.goods_id‘)
->field(‘a.*,b.goods_sn,b.goods_name,b.goods_barcode‘)
->select();
$res2 = M(‘stat_info a‘)
->join(__STOCK__.‘ b ON a.goods_id = b.goods_id‘)
->field(‘a.*,b.goods_sn,b.goods_name,b.goods_barcode‘)
->select();
$res = M(‘stat_info a‘)
->join(‘__STOCK__ b ON a.goods_id = b.goods_id‘)
->field(‘a.*,b.goods_sn,b.goods_name,b.goods_barcode‘)
->where(‘a.stat_id=‘.$id)
->select();
两种方法都可以
$res = M(‘stat_info a‘)
->join(‘__STOCK__ b ON a.goods_id = b.goods_id‘)
->join(‘__DEPOT__ C ON b.depot_id = c.id‘)
->field(‘a.*,b.goods_sn,b.goods_name,b.goods_barcode,c.depot_name‘)
->where(‘a.stat_id=‘.$id)
->select();
时间: 2024-10-01 06:08:52