我有一个这样的查询,它已经是双引号。
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”列中有空格,但由于查询已在双引号内,我该如何编写列名?在这种情况下如何逃避双引号?
答案 0 :(得分:4)
如果您对此使用C#
,Java
或PHP
,请使用反斜杠\
result = db.Query("SELECT ACTUAL_N_WELLS, TARGET_N_WELLS, \"YTD ACTUAL\" AS YTD_ACTUAL....");