postgresql - SQL IF [complex condition] THEN OUTPUT NEW TABLE -
i'm not sure how approach problem.
i need output table containing 1 row "yes" if complex condition met. how got doing this?
the condition this: "if age difference between oldest , youngest professors between 2004 , 2008 @ 10 years"...
i'm using postgresql.
thanks.
based on description, should work.
select case when (date_part('year', max(birthdate)) - date_part('year', min(birthdate))) * 12 + (date_part('month', max(birthdate)) - date_part('month', min(birthdate))) <= 120 'yes' else 'no' end professors dateemployed between '2004-01-01' , '2008-12-31';
Comments
Post a Comment