Hello, all.
I'm trying to create a view that uses CASE statements in the column expression to categorize, so that all the logic is in setting up the view. Then nothing else needs to know all the rules, and if / when the rules change, I can simply drop and re-create the view without changing any other queries --- in SA or outside it.
EG
CREATE TABLE people ( name VARCHAR(10), income INTEGER );
INSERT INTO people (name, income) VALUES ( 'bob', 123456);
INSERT INTO people (name, income) VALUES ( 'barry', 35467);
INSERT INTO people (name, income) VALUES ( 'betty', 95672);
CREATE VIEW people_income_class AS SELECT name, income, CASE WHEN income < 50054 THEN 'below median' ELSE 'above median' END AS income_class FROM people;
In this case I'd like to have the people_income_class view come from a SA select, with the median income, 50054, coming from a bound parameter.
Anyone have suggestions?
Richard