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

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

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -