【在 a*z 的大作中提到】 : How to query stock price table (price in double) and return the the top 10% : of the highest percent return? : Thanks.
a*z
6 楼
Thank you all for your info. date price 1 12 2 23 3 10 ... I was asked to query the table in SQL 2005 to get the top 10% of performance {(price - prior price)/price} without defining function. Thank you again.
B*g
7 楼
sql server 呀 SELECT TOP(10) PERCENT 。。。。。。。
performance
【在 a*z 的大作中提到】 : Thank you all for your info. : date price : 1 12 : 2 23 : 3 10 : ... : I was asked to query the table in SQL 2005 to get the top 10% of performance : {(price - prior price)/price} without defining function. Thank you again.
a*z
8 楼
yes, I thought that. select top 10 percent (price - lag(price))/price pctChange from .... order by pctChange that pctChange needs to be calc'ed from price with 1 period lag. I do not know if it works. Thank you very much.
c*e
9 楼
qualify with rank/row_number() etc
%
【在 a*z 的大作中提到】 : How to query stock price table (price in double) and return the the top 10% : of the highest percent return? : Thanks.