'If else' like structure in Db2
Posted on 2007-10-02
i have a simple query
from my front end i have a drop -down 'Minutes' which can have 6 values 'o','H','K','L','U'
For each of these values i have a column in the table PLANS.these are the corresponding columns
Now In my query , i want to check what the user has selected in the drop down and query against the
appripriate column. For example, if user has selected 'o' , then query against 'o_min'
FROM PLANS A
if $min_type$ is 'o'
(A.o_min = #passed value#) //if user has selected 'o' in drop-down.
else if $min_type$ is 'H'
(A.H_min = #passed value#) //if user has selected 'H' in drop-down.
and so on...
* $min_type$ is the value of whatever is selected in the front-end. It can have either of these values
'o','H','K','L','U'. I am passing the value of $min_type$ programatically in the query
any ideas, how i can make this work. Is ther a 'If else' like construct which i can use?