CASE statement in WHERE clause of SQL Query
I want to write a query that builds a WHERE clause at runtime based on a condition. This is what I want to do.
SELECT name from data_table WHERE
CASE
WHEN input_data = location THEN <where condition should be based on location>
WHEN input_data = college THEN <where condition should be based on college name>
How should I do it? Is it possible?
+3
source to share