我的查询中的一个字段(DSum("AuM","tbl_Client","Portfolio='" & [Portfolio] & "'") AS PortfolioAuM
)无法格式化。
我试过了:
#'##0.0
字段属性中编写Format
来手动设置格式。Format(DSum("AuM","tbl_Client","Portfolio='" & [Portfolio] & "'")
AS PortfolioAuM,'#'##.0')
Double
这些尝试都没有奏效。 如何格式化此字段?为什么会这样?
这是我的SQL代码:
SELECT tbl_Client.CIF, tbl_Client.Portfolio,
tbl_Criteria_Comp.Buyer_Review_StatusID,
tbl_Criteria_Comp.Comp_Review_StatusID,
tbl_Criteria_Tax.Tax_review_StatusID,
tbl_Client.AuM,
DSum("AuM","tbl_Client","Portfolio='" & [Portfolio] & "'") AS PortfolioAuM,
tbl_Client.BuyersReviewStatus,
[AuM]/[PortfolioAuM] AS AuMPoT,
tbl_Client.EntryDateReview
FROM
(tbl_Client INNER JOIN tbl_Criteria_Comp ON tbl_Client.CIF = tbl_Criteria_Comp.CIF)
INNER JOIN tbl_Criteria_Tax ON tbl_Client.CIF = tbl_Criteria_Tax.CIF;
答案 0 :(得分:1)
我建议将SQL表达式更改为以下内容,以避免使用DSum
函数:
SELECT
tbl_Client.CIF,
tbl_Client.Portfolio,
tbl_Criteria_Comp.Buyer_Review_StatusID,
tbl_Criteria_Comp.Comp_Review_StatusID,
tbl_Criteria_Tax.Tax_review_StatusID,
tbl_Client.AuM,
t.PortfolioAuM,
tbl_Client.BuyersReviewStatus,
[AuM]/[t.PortfolioAuM] AS AuMPoT,
tbl_Client.EntryDateReview
FROM
(
(
tbl_Client INNER JOIN
(
SELECT Portfolio, SUM(AuM) AS PortfolioAuM
FROM tbl_Client
GROUP BY Portfolio
) t
ON tbl_Client.Portfolio = t.Portfolio
)
INNER JOIN tbl_Criteria_Comp ON tbl_Client.CIF = tbl_Criteria_Comp.CIF
)
INNER JOIN tbl_Criteria_Tax ON tbl_Client.CIF = tbl_Criteria_Tax.CIF;
这应该保留AuM
字段的数据类型,因此允许您使用标准格式选项。
答案 1 :(得分:0)
SQL Query中的正确格式部分应为
AM <- AM %>%
rowwise() %>%
convert_AM_names(., AM)
我还认为修改SQL查询是最好的想法。