Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: How to return a value per WHERE conditions in postgresql SELECT in single query?

Mojtaba Arvin:

I'm looking to write a Postgresql SELECT in single query with WHERE conditions :


SELECT 1 FROM foo_table
WHERE a = true
AND b = true
AND c = true

to do the following :


if (a and b and c) :
return 1
elif not ( a and b) :
return 2
elif not ( a and b and c) :
return 3

What is the best way?



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: How to return a value per WHERE conditions in postgresql SELECT in single query?

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×