码迷,mamicode.com
首页 > Web开发 > 详细

thinkphp 3.2 join

时间:2016-09-03 19:35:37      阅读:415      评论:0      收藏:0      [点我收藏+]

标签:

$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();

thinkphp 3.2 join

标签:

原文地址:http://www.cnblogs.com/wesky/p/5837740.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!