ci小新 发表于 2010-3-30 15:03:10

谁知道用ci怎么写关于between and的sql语句?

:)
大家好~ 请问谁知道ci里的between and 是怎么写的~就像就平均的话是select_avg(),那bentween and 的写法是什么?
例如 select prod_name,prod_price from products where prod_price between 5 and 10;
请各位高手指教~

jeongee 发表于 2010-3-30 15:23:57

额,你就直接写sql语句就好了呀,写完了,用$this->db->query($sql)
或者用$this->db->where('prod_price between 5 and 10');

ci小新 发表于 2010-3-30 15:38:48

回复 2# ywqbestever


    恩~ 谢谢你啊~ 不过betwenn and 有没有类似select_num()的做法啊~

visvoy 发表于 2010-3-30 20:37:11

没有

uroko 发表于 2010-3-30 20:40:30

没有吧,这里面没有,就应该没有的。
system/database/DB_active_rec.php

ci小新 发表于 2010-3-31 09:31:42

回复 4# visvoy

哦~谢谢你啊~:loveliness:

ci小新 发表于 2010-3-31 09:32:48

回复 5# uroko


    恩 ~ 我在网上找了很做资料也没有~呵呵 看来真的没有了~

ci小新 发表于 2010-4-13 17:59:41

select prod_name,prod_price from products where prod_price between 5 and 1;
$this->db->select('prod_name,prod_price');
$this->db->where('prod_price between 5 and 1');
$this->db->get('products');
目前也只能用这个方法了~

oraclelee 发表于 2011-12-26 13:18:55

ci小新 发表于 2010-4-13 17:59 static/image/common/back.gif
select prod_name,prod_price from products where prod_price between 5 and 1;
$this->db->select('prod_ ...

谢谢了。正需要。

寄语残云 发表于 2017-7-19 16:16:45

本帖最后由 寄语残云 于 2017-7-19 16:20 编辑

$this->db->select('prod_name, prod_price')->where(['prod_price >'=>5, 'prod_price <'=>10])->get('products')->result_array();
CI框架的连贯操作,请参考
页: [1]
查看完整版本: 谁知道用ci怎么写关于between and的sql语句?