jjlbmcnews
IS-IT--Management
Hi,
I have a stored procedure that depending on various conditions executes differently. Now I really can't get my head around how this will work, basically I have a standard SELECT query, if one or any of three conditions are true I want the select query to perform a JOIN to another table and add a few WHERE clauses. The stored procedure can be executed by parsing blank parameters so the standard SELECT query results are returned, if any of the parameters contain a value the query results another result set. Whats the best way to approach this? I was thinking of using IF....THEN....ELSE to get the results I want but I'm not sure if this is ideal.
I have a stored procedure that depending on various conditions executes differently. Now I really can't get my head around how this will work, basically I have a standard SELECT query, if one or any of three conditions are true I want the select query to perform a JOIN to another table and add a few WHERE clauses. The stored procedure can be executed by parsing blank parameters so the standard SELECT query results are returned, if any of the parameters contain a value the query results another result set. Whats the best way to approach this? I was thinking of using IF....THEN....ELSE to get the results I want but I'm not sure if this is ideal.