"-6ren">
gpt4 book ai didi

mysql - 如何在 codeigniter 中使用 order by 制作自定义 SQL

转载 作者:行者123 更新时间:2023-11-29 06:50:32 24 4
gpt4 key购买 nike

我的代码在这里 Sql 查询:

$sql ="select * from products where status='1' AND country='5' AND product_price > "50" AND product_price <= "100" order by product_id desc";
$product=$this->db->query($sql)->result_array();

使用自定义 SQL 查看所有产品,但仍未按描述显示顺序。

最佳答案

试试这个:

$sql = "SELECT * FROM `products` WHERE `status`=1 AND `country`=5 AND `product_price` > 50 AND `product_price` <= 100 ORDER BY `product_id` DESC";
$product = $this->db->query($sql)->result_array();

关于mysql - 如何在 codeigniter 中使用 order by 制作自定义 SQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47688853/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com