Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Equal operation in PostgreSQL

Hey I am trying to compare two values against another value,
is it possible to just write A=B=3 instead of A=3 AND B=3?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

No, that’s not possible.

If you want to avoid writing the constant multiple times, you can use:

3 = all(array[a,b])

alternatively using standard SQL

3 = all( values(a),(b) )

Or use an AND condition:

a = b and a = 3
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading