I want to include a JOIN in my stored procedure based on a boolean parameter passed to it.
I have tried this, but it is giving an error saying I have incorrect SQL syntax when I try and execute it.
Anyone know if this is possible?Code:FROM user_tasks LEFT JOIN user_tasks_links ON (user_tasks_links.todoref=user_tasks.todoref AND user_tasks_links.userref=@userref) LEFT JOIN users ON users.userref=user_tasks.cur_user IF (@CompanyOwn=False AND @CompanyBelow=False) THEN LEFT JOIN visitors ON visitors.userref=user_tasks.visitorref; END IF;



LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks