Answer the question
In order to leave comments, you need to log in
How to elegantly check that several conditions are met or not met at the same time?
Let's say there are three conditions, let's express them with the letters A, B, C.
We need to somehow elegantly check whether they are all met at the same time or not at the same time. You can write it like this
:
And how to write the same thing in postgres, but so that A, B and C in the formula meet once. For example, you can do this :
And how can this be done elegantly, so as not to be ashamed?
(A and B and C) or (not A and not B and not C)
(A)::int + (B)::int + (C)::int IN (0, 3)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question