I need to display the middle value of three columns in a sql table.
eg: For data
col1 col2 col3
759 736 773
Then output should be 759
.
What is the best way to do it?
For Oracle, MySql and Postgres:
select col1 + col2 + col3 - greatest(col1, col2, col3) - least(col1, col2, col3)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With