首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >错误号:“on子句”中的1054列'2021-08-23‘

错误号:“on子句”中的1054列'2021-08-23‘
EN

Stack Overflow用户
提问于 2021-08-27 09:20:03
回答 2查看 391关注 0票数 0

我通过左联接连接了这个查询中的许多表,我想在表上应用条件,但是php给了我以下错误

错误号:“on子句”中的1054个未知列'2021-08-23‘

选择i.isn_Add_Date、s.scentre_Name、i.isn_Job_No、cp.cpart_Part_Id、cp.cpart_Part、cp.cpart_Qty、cp.cpart_Rate、cp.cpart_Amount、p.product_Name、m.model_Name、c.complaint_Job_No、c.complaint_Add_Date、c.complaint_Under_Warranty、cp.cpart_Qty、cp.cpart_Ratecp.cpart_Amount从抱怨为c左加入complaint_parts as cp ON c.complaint_Id = cp.cpart_Complaint_Id左连接中心as s ON s.scentre_Id = c.complaint_Scentre_Id左连接产品as p ON p.product_Id = c.complaint_Product_Id左连接模型m ON m.model_Id = c.complaint_Model_Id左连接是像i ON i.isn_Complain_Number = c.complaint_Job_No和i.isn_Add_Date在‘2021年-08-23‘和'2021-08-26’其中c.complaint_Scentre_Id = '1‘和c.complaint_Status =’交付‘和c.complaint_Trash =0

这里是我的php代码

代码语言:javascript
运行
复制
$this->db->select('i.isn_Add_Date,s.scentre_Name,i.isn_Job_No,cp.cpart_Part_Id,cp.cpart_Part,cp.cpart_Qty,cp.cpart_Rate,cp.cpart_Amount,p.product_Name,m.model_Name,c.complaint_Job_No,c.complaint_Add_Date,c.complaint_Under_Warranty,cp.cpart_Qty,cp.cpart_Rate,cp.cpart_Amount');
            
            $this->db->join('complaint_parts as cp', 'c.complaint_Id = cp.cpart_Complaint_Id ', 'left');
            
            $this->db->join('scentres as s', 's.scentre_Id = c.complaint_Scentre_Id', 'left');
            $this->db->join('products as p', 'p.product_Id = c.complaint_Product_Id', 'left');
            $this->db->join('models as m', 'm.model_Id = c.complaint_Model_Id', 'left');

            $this->db->JOIN('isn as i', 'i.isn_Complain_Number = c.complaint_Job_No AND i.isn_Add_Date BETWEEN '.str_replace('/', '-', $fromDate).' AND '.str_replace('/', '-', $toDate).'', 'LEFT'); 
            
            
            
            $this->db->where("c.complaint_Scentre_Id", $serviceCenterId[0]);
            $this->db->where("c.complaint_Status",'Delivered');
            $this->db->where("c.complaint_Trash", 0);
            
            $query = $this->db->get("complaints as c");
EN

Stack Overflow用户

发布于 2021-08-27 10:20:11

sql是可以的,也许orm不能处理复杂的连接条件。

您可以将联接条件[和i.isn_Add_Date在'2021-08-23‘和’2021-08-26‘之间移动到哪个条件

就像$this->db->where("i.isn_Add_Date",介于'2021-08-23',‘2021-08-26’之间);

票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68950988

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档