MySQL Stored Procedure Conditional Statement -


can me on how have conditional statement on mysql stored procedure?

i have sample query,

if stored procedure parameter isfirsttask = true use left join else use inner join

select * jobdetails jd inner join taskslogs tl on jd.jobid = tl.jobid; 

the question how change inner join left join without repeating whole query replace 1 word. assuming query bulk. possible? idea please.

select * jobdetails jd       left join taskslogs tl on jd.jobid=tl.jobid if(isfirsttask = true, true, tl.jobid not null); 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

asp.net mvc - Implementing normal user/pass, Twitter & Facebook auth -