gpt4 book ai didi

mysql - CodeIgniter 连接器

转载 作者:行者123 更新时间:2023-12-01 00:33:18 29 4
gpt4 key购买 nike

我花了几个小时盯着这段代码。请新鲜的眼睛! 这是查询的简化版本:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL 
server version for the right syntax to use near
'FROM (`requests` c) JOIN `inventory` d ON `d`.`listing_seq_no` = `c' at line 7


SELECT DISTINCT `c`.`req_id`, `u`.`user_id`, `u`.`org_name`,
CONCAT_WS(' ', `l`.`strength`, `l`.`unit)` as dos, `c`.`quantity` AS quantity1,
(SELECT sum(quantity) from inventory d2
WHERE d2.listing_seq_no = c.listing_seq_no
) as inv_total,
FROM (`requests` c)
JOIN `inventory` d
ON `d`.`listing_seq_no` = `c`.`listing_seq_no`
JOIN `listings` l
ON `l`.`listing_seq_no` = `c`.`listing_seq_no`

编辑:原始 CodeIgniter 代码片段:

$this->db->select ( "c.req_id,
u.user_id,
u.org_name,
l.tradename as name,
CONCAT_WS(' ', l.strength, l.unit) as dos,
);

最佳答案

这个:

CONCAT_WS(' ', `l`.`strength`, `l`.`unit)`

应该是:

CONCAT_WS(' ', `l`.`strength`, `l`.`unit`)

关于mysql - CodeIgniter 连接器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2212187/

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