"FROM " . $GLOBALS['ecs']->table('order_goods')." AS og, ".$GLOBALS['ecs']->table('order_info')." AS oi ".
后面加(注意点号的连接):
" LEFT JOIN ". $GLOBALS['ecs']->table('goods') . "AS g ON og.goods_id = g.goods_id ".
然后在开头的sql语句后面这里加上你要的字段:
$sql = 'SELECT og.goods_id, og.goods_sn, og.goods_name,og.goods_attr, og.goods_number AS goods_num, og.goods_price, g.gonghuojia '.
最后你去测试看一下行不行.
你这个不能这样查询,利用中间表(bookinfo)关联其它两表bookid booknotesselect bookinfo.isbn,booknotes.tiaoma,bookinfo.title,bookinfo.price,booknotes.bdate.booknotes.rdate from bookinfo left join bookid on bookinfo.isbn=bookid.isbn left join booknotes on bookinfo.id=booknotes.id
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)