由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - 谁能帮我看看怎么RE-WRITE这段CODE?
相关主题
这个QUERY怎么优化啊?Is there such a thing as "limited writing access" in Oracle database server
ORA0-01422How to write this query in Oracle?
求问 Oracle Materialized Viewhow to write this query
ACT4.0 (Symantec)再问I/O WAIT的问题
Help - Urgent费城公司急聘懂Oracle Report Writing 的 IT Manager
How to write logger of SP?How to write this loop SQL query?
小问题今天火大了
每天第一次连接ORACLE的数据库都失败,SOCKET WRITE ERRORDB的性能下降是因为分表造成的吧
相关话题的讨论汇总
话题: code话题: product话题: accrual话题: account话题: collateral
进入Database版参与讨论
1 (共1页)
m****e
发帖数: 1197
1
原来的是:
SELECT dbo.tblDim_Period.Code AS MnthYr, dbo.tblDim_Account.Code AS
Account, dbo.tblDim_Prism.Code AS Prism, dbo.tblDim_Facility.Code AS
Facility,
dbo.tblDim_Product.Code AS Product, CASE WHEN dbo.
tblDim_Product.Accrual IS NULL
THEN 'ACT_ACT' ELSE dbo.tblDim_Product.Accrual END AS
ProdAccrl, dbo.tblDim_Channel.Code AS Channel, dbo.tblDim_Collateral.Code AS
Collateral,
dbo.tblDim_Reprice.Code AS RePrice, dbo.tblDim_Purpo
i****a
发帖数: 36252
2
what's the purpose of rewriting? or what are you trying to archive?
m****e
发帖数: 1197
3
try to see the difference. can you help? thanks.

【在 i****a 的大作中提到】
: what's the purpose of rewriting? or what are you trying to archive?
i****a
发帖数: 36252
4
My question is what kind of difference you want to see. If the query is
giving you the correct result then its a correct query.
Often there are multiple ways to write a query in sql. Access generated or
not, there is no need to rewrite a query just because you can. Unless you
thing there is a performance problem.

【在 m****e 的大作中提到】
: try to see the difference. can you help? thanks.
m****e
发帖数: 1197
5
i need to add 5 fields to this, but someone told me it would take hours to
do that, because it needs "pivot" in SQL. i don't get it.
in what situation it would need pivot by adding new fields to a table?

【在 i****a 的大作中提到】
: My question is what kind of difference you want to see. If the query is
: giving you the correct result then its a correct query.
: Often there are multiple ways to write a query in sql. Access generated or
: not, there is no need to rewrite a query just because you can. Unless you
: thing there is a performance problem.

i****a
发帖数: 36252
6
If those 5 fields contains multiple rows per lookup and you need to treat
them as different columns, then you need to pivot them.
I think you should communicate with your programmers better.

【在 m****e 的大作中提到】
: i need to add 5 fields to this, but someone told me it would take hours to
: do that, because it needs "pivot" in SQL. i don't get it.
: in what situation it would need pivot by adding new fields to a table?

1 (共1页)
进入Database版参与讨论
相关主题
DB的性能下降是因为分表造成的吧Help - Urgent
10 things that could happen after US debt downgradeHow to write logger of SP?
要推波助澜小问题
写文章经常有畏惧心理每天第一次连接ORACLE的数据库都失败,SOCKET WRITE ERROR
这个QUERY怎么优化啊?Is there such a thing as "limited writing access" in Oracle database server
ORA0-01422How to write this query in Oracle?
求问 Oracle Materialized Viewhow to write this query
ACT4.0 (Symantec)再问I/O WAIT的问题
相关话题的讨论汇总
话题: code话题: product话题: accrual话题: account话题: collateral