SQL get the value above(larger) and below(smaller) of an inbetween value in a select statement
I have a table containing two columns "allowable" and "thickness".
The thickness values are let say 1.2 2 3 4,3 I'm trying to write a udf which can take any thickness (eg2.3) and then it interpolates the allowable values. My question is 开发者_JS百科if there is a smart (or maybe even out of the box) function which returns the upper and lower thickness value I need (2 and 3). Regards, Lumpi I'm using ms sql server 2008..
select 'max', max(thickness) value from thicknesses where thickness < requirement
union
select 'min', min(thickness) value from thicknesses where thickness > requirement
精彩评论