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
Post a Comment