关于sql查询的语句
是想执行这样语句sql$sql = select count(*) from goods_stock_info where goods_id = 13 and goods_intact_num > 0 or goods_return_num >0 or goods_damage_num >0;
用CI里面的方法对应写
$this->db->select("*");
$this->db->from("goods_stock_info");
$this->db->or_where(array('goods_intact_num > '=>0,'goods_return_num >'=>0,'goods_damage_num >'=>0));
$this->db->where('goods_id',$goods_id);
$query = $this->db->count_all_results();
难道这样不对?反正执行的结果是不对。
echo $this->db->last_query();看下不就都清楚了 这么复杂的语句 直接用 query 吧,别用 AR 了 Hex 发表于 2013-4-11 19:33 static/image/common/back.gif
这么复杂的语句 直接用 query 吧,别用 AR 了
嗯 还真最后就是用query写的。
页:
[1]