MYsqlL IF status = 0语句从不返回row,如果我删除IF语句,它将起作用

编程入门 行业动态 更新时间:2024-10-11 03:18:56
本文介绍了MYsqlL IF status = 0语句从不返回row,如果我删除IF语句,它将起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

亲爱的所有人: 我是MySql的新手 请帮助我在该IF语句中弄错的地方,即当我给出最后一个paramenter(Status)= 0时,该IF语句未运行. 在查询编辑器中运行相同查询时,它们独立运行良好. 还告诉我一些真实的MYSQL环境esp.运行功能和过程. 谢谢 纳兹什

Dear All: i m a newbie in MySql kindly help me where i m mistaken in that IF Statement that its not running when i give last paramenter(Status)=0. Same queries working fine independently when i run them in query editor. also tell me some authentice MYSQL envoirnment esp. to run Functions and procedure. thanks Nazish

BEGIN IF (Status =0) THEN SELECT * , st.SRTech_Description AS RStatus, st.SRTechStatus_Name AS RSInitials FROM requestdeployment rd, sr_TechStatus st, SupportRequest SR LEFT JOIN Locations L ON SR.SR_SupportLId = L.Id WHERE Scc_id IN ( Con ) AND sr.SR_id = rd.requestid AND SRTechStatus_ID IN ( SELECT STATUS FROM requestdeployment WHERE RequestId = SR.SR_Id ) and rd.active!=1 and rd.deployedby=DPID and rd.status=st.srtechstatus_id; ELSE SELECT * , st.SRTech_Description AS RStatus, st.SRTechStatus_Name AS RSInitials FROM requestdeployment rd, sr_TechStatus st, SupportRequest SR LEFT JOIN Locations L ON SR.SR_SupportLId = L.Id WHERE Scc_id IN ( Con ) AND sr.SR_id = rd.requestid AND SRTechStatus_ID IN ( SELECT STATUS FROM requestdeployment WHERE RequestId = SR.SR_Id ) and rd.active!=1 and rd.deployedby=DPID and rd.status=st.srtechstatus_id and st.SrtechStatus_ID=Status; END IF; END

推荐答案

我觉得您可能在传递参数错误,并且结果Select永远不会设置为0,因此第一个查询永远不会运行. 您需要返回到原始代码,检查如何传递Select的值.还要检查存储过程(如果是上述内容),则如何定义Select. I get the feeling you are maybe passing in the parameter wrong, and as a result Select is never being set to 0 so the first query never runs. You need to go back to your original code, check how you are passing in the value of Select. Also check in the Stored Procedure (If that is what is above), how Select is being defined.

更多推荐

MYsqlL IF status = 0语句从不返回row,如果我删除IF语句,它将起作用

本文发布于:2023-10-19 17:49:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1508306.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语句   它将   MYsqlL   status   row

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!