ci 数据库查询语句有sql 中between and 么?

ci 数据库查询语句有sql 中between and 么?,第1张

这个木有哦。 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')目前也只能用这个方法了~

直接取一维数组是取不到了

只能把二维转成一维的了:

用result_array取到二维数组

再用array_column,转为一维数组

例:

$sql = 'select name from user'

$result = $this->db->query($sql)->result_array()

$one = array_column($result, 'name')

print_r($one)//这个就是一维数组了

一个基本查询的逻辑过程:

(8) SELECT (9) DISTINCT (11) <TOP_specification><select_list>

(1) FROM <left_table>

(3)<join_type>JOIN <right_table>

(2) ON <join_condition>

(4) WHERE <where_condition>

(5) GROUP BY <group_by_list>

(6) WITH {CUBE | ROLLUP}

(7) HAVING <having_condition>

(10) ORDER BY <order_by_list>--数字表示的是语句中部分的执行顺序。完全的结构语句如下列: SELECT DISTINCT top 5 * FROM table1

left JOIN table2 ON (table1.id=table2.id)

WHERE table1.id>10 GROUP BY table1.id HAVING table1.name like '张%'

ORDER BY name


欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/sjk/6776311.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-28
下一篇 2023-03-28

发表评论

登录后才能评论

评论列表(0条)

保存