Trying to do this:
SELECT CASE WHEN field = true THEN one * another ELSE one END as case_field
FROM table WHERE case_field >= 9000
and receive an error that case_field doesn’t exist.
Is it possible to do this without duplicating CASE ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Looks like PostgresSQL supports derived tables
You might want to check that it doesn’t have any adverse affect on the execution plan.