由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - a problem, thank you
相关主题
请教一个SQL Query请教大牛一道有趣的SQL题
[转载] Can anyone interpret this simple SQL?oracle和XML
Help about a SQL statementHow to query a tree
To get the 2nd, 3rd, 4th largest valuepls help me in this Sql query
请问T-SQL中Group By之后怎么找到特定的recordask for help with a simple query!!!
一个sql问题:怎样实现 (((a1*10)+a2)*10+a3)*10 ... (转载)问个SQL的问题
T-SQL Update Statement QuestionSQL server 2000有hidden records吗?
猪一样的队友誰來幫我開來開悄? Interesting SQL query
相关话题的讨论汇总
话题: problem话题: price话题: percent话题: top话题: pctchange
进入Database版参与讨论
1 (共1页)
a*z
发帖数: 294
1
How to query stock price table (price in double) and return the the top 10%
of the highest percent return?
Thanks.
e********g
发帖数: 2524
2
俺菜鸟,不是可以Desc 排序吗?

%

【在 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
发帖数: 294
3
percent return needs to be calc'ed, but not allowed to write function.
e********g
发帖数: 2524
4
你调用sql的程序不能算吗?还是说数据库一般都不这么用的?
俺是外行

【在 a*z 的大作中提到】
: percent return needs to be calc'ed, but not allowed to write function.
B*****g
发帖数: 34098
5
啥db。
啥version。
其实不用看了,google "over() partition by"

%

【在 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
发帖数: 294
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
发帖数: 34098
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
发帖数: 294
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
发帖数: 8624
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.

1 (共1页)
进入Database版参与讨论
相关主题
誰來幫我開來開悄? Interesting SQL query请问T-SQL中Group By之后怎么找到特定的record
请教2个sql query 问题一个sql问题:怎样实现 (((a1*10)+a2)*10+a3)*10 ... (转载)
Merge table with one single query?T-SQL Update Statement Question
怎么求和猪一样的队友
请教一个SQL Query请教大牛一道有趣的SQL题
[转载] Can anyone interpret this simple SQL?oracle和XML
Help about a SQL statementHow to query a tree
To get the 2nd, 3rd, 4th largest valuepls help me in this Sql query
相关话题的讨论汇总
话题: problem话题: price话题: percent话题: top话题: pctchange