2

我有一个这样的查询,它已经用双引号括起来了。

result = db.Query("SELECT ACTUAL_N_WELLS, TARGET_N_WELLS, YTD ACTUAL AS YTD_ACTUAL, 
YTD BUDGET AS YTD_BUDGET, (CONVERT(DATETIME,PERIOD,112)) AS DATES 
FROM DASH_GL_DRILLING_PERF
 WHERE ASSET_NAME='Bab & Gas Asset' 
AND (  to_date(DASH_GL_DRILLING_PERF.PERIOD,'yyyy/mm/dd') > 
(SELECT add_months(max(to_date(DASH_GL_DRILLING_PERF.PERIOD,'yyyy/mm/dd')),-3) 
from DASH_GL_DRILLING_PERF))");

在此列“YTD ACTUAL”和“YTD BUDGET”有空格,但由于查询已经在双引号内,我该如何写列名?在这种情况下如何转义双引号?

4

1 回答 1

4

如果您使用C#,JavaPHP在此上,请使用反斜杠转义双引号\

result = db.Query("SELECT ACTUAL_N_WELLS, TARGET_N_WELLS, \"YTD ACTUAL\" AS YTD_ACTUAL....");
于 2012-09-25T07:34:11.777 回答