List:General Discussion« Previous MessageNext Message »
From:Peng Yu Date:April 26 2010 11:08pm
Subject:How to compute the min and max of two numbers?
View as plain text  
I don't see there is a function to compute min or max of two numbers
in a row. Essentially I want to select all the rows where the minimum
of column1 and column2 are bigger than the maximum of col3 and col4
(The following code won't work as I expected, if I am correct).

select * from a_table where min(col1, col2) >= max(col3,col4)

I could expand the above expression to just using primitive
comparisons. But it would not be very readable. I'm wondering if there
is a better way to do so in sql.

-- 
Regards,
Peng
Thread
How to compute the min and max of two numbers?Peng Yu27 Apr
  • Re: How to compute the min and max of two numbers?Jesper Wisborg Krogh27 Apr
  • Re: How to compute the min and max of two numbers?Peter Brawley27 Apr