Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

SQL
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
Posted
Updated 22-Jan-11 1:56am
v2
Comments
DaveAuld 22-Jan-11 7:56am    
Edit: Added formatted code block

1 solution

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.
 
Share this answer
 
Comments
Estys 22-Jan-11 8:13am    
Just a question : Why are you answering all these old questions? The OP's have probably died of old age.
DaveAuld 22-Jan-11 8:17am    
a) Because they are still open;
b) Because i have never seen them, and just pondering through them
c) If the OP's are like me, are working lots of different things, and if stuck on one thing put it to the side for a few weeks and get on with something else.
d) Why not?

Just a question: Why are you looking at the old questions?
Estys 22-Jan-11 8:30am    
I'm looking because they popped up on top of the list and I noticed a flurry of first answers to questions from '09.
My question to you wasn't meant to be flippant, I was just curious.
DaveAuld 22-Jan-11 8:32am    
Thats ok, i'm just playing with you :)

I wish CP would implement the Q&A purge for question older than say 90days are wiped off the system (providing no answer has been given).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900