I'm using this SQL to determine the median of a group of temperatures...
select x.TEMP from QGPL/WEATHER1 x, QGPL/WEATHER1 y
group by x.TEMP
having sum(case when y.TEMP <= x.TEMP then 1 else 0 end)
sum(case when y.TEMP >= x.TEMP then 1 else 0 end)>= count(*)/2 + 1
If I want the 1st quartile, why couldn't I use the same code but insert a WHERE statement that selects only those values < the value returned from the first SQL? If I want the 3rd quartile, select only those values > value returned from first SQL?
If so, how do I modify the statement to include that WHERE statement?
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!