I am having trouble using CASE when attempting to return the appropriate results based on whether a certain value is passed.
For example I would like to run a query if the suburb is passed
WHEN @suburb <> '' THEN
@suburb
END
= [Suburb]
AND
[City] = @city
However how do I only run the query so that when no suburb is passed it only uses the city?
Should I rather write the query as follows?
WHERE
(
[Suburb] = @suburb
AND
[City] = @city
)
OR
(
[City] = @city
)