Redian新闻
>
谁能帮我看看怎么RE-WRITE这段CODE?
avatar
谁能帮我看看怎么RE-WRITE这段CODE?# Database - 数据库
m*e
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
avatar
i*a
2
what's the purpose of rewriting? or what are you trying to archive?
avatar
m*e
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?
avatar
i*a
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.
avatar
m*e
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.

avatar
i*a
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?

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。