Home > Back-end >  In Snowflake how to find smallest value for each row from 'N' number of columns without in
In Snowflake how to find smallest value for each row from 'N' number of columns without in

Time:10-09

I have table with columns like Col1, Col2, Col3... ColN

The table value is something like this

ID Col1 Col2 Col3 Col4 Expected Output
1 10 NULL 500 5 5
2 15 1 400 NULL 1
3 20 2 NULL 10 2

I tried

SMALLEST(VAL1,VAL2, VAL3... VALN)

But it returns NULL value. I want to ignore NULL Values and compare non-null values.

Please help on this. Thanks

CodePudding user response:

Check out LEAST: enter image description here

  • Related