Skip to content
Advertisement

Checking multiple columns for one value with greater than or equal (>=)

Let’s say i’m having a table like this:

I wish to check if any of col1,col2,col3,col4 are greater than or equal 10

The idea was smth like

Is there any more optimized way?

I thought that I could use IN, but as don’t have any clue how to use >= in it.

Advertisement

Answer

Assuming none of the values are NULL, you can use least():

This is no more efficient, but it is shorter.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement