Hi, all,

I think I'm using this function correctly, but maybe someone can shed some light on the situation. Here is my SQL statement:

The error I am receiving says this:SELECT dt AS AY, sum(IF lag='200112' val ELSE 0) AS C1, sum(IF lag='200201' val ELSE 0) AS C2, sum(IF lag='200202' val ELSE 0) AS C3, sum(IF lag='200203' val ELSE 0) AS C4, sum(IF lag='200204' val ELSE 0) AS C5, sum(IF lag='200205' val ELSE 0) AS C6, sum(IF lag='200206' val ELSE 0) AS C7, sum(IF lag='200207' val ELSE 0) AS C8, sum(IF lag='200208' val ELSE 0) AS C9, sum(IF lag='200209' val ELSE 0) AS C10, sum(IF lag='200210' val ELSE 0) AS C11, sum(IF lag='200211' val ELSE 0) AS C12, sum(IF lag='200212' val ELSE 0) AS C13, sum(IF lag='200301' val ELSE 0) AS C14, sum(IF lag='200302' val ELSE 0) AS C15, sum(IF lag='200303' val ELSE 0) AS C16, sum(IF lag='200304' val ELSE 0) AS C17, sum(IF lag='200305' val ELSE 0) AS C18, sum(IF lag='200306' val ELSE 0) AS C19, sum(IF lag='200307' val ELSE 0) AS C20, sum(IF lag='200308' val ELSE 0) AS C21, sum(IF lag='200309' val ELSE 0) AS C22, sum(IF lag='200310' val ELSE 0) AS C23, sum(IF lag='200311' val ELSE 0) AS C24, sum(IF lag='200312' val ELSE 0) AS C25

FROM

(SELECT [AY] AS dt, [CY] AS lag, round(sum(PAID),0) AS val

FROM

(SELECT [CM] AS CY, [AM] AS AY, [RM] AS RY, [PM] AS PY, [PRD_CODE] AS PRD_CODE, [PAID] AS Paid, [OS] AS OS, [AGE] AS AGE FROM Hospitalization_small.csv)

GROUP BY AY, CY HAVING AY BETWEEN '200112' AND '200312')

GROUP BY dt ORDER BY dt

The Korean translates to "Query is a syntax error which is not operator." I'm thinking it's a problem with SUM, but I'm not too sure. Can anybody help me out?System.Data.OleDb.OleDbException: 'sum(IF lag='200112' val ELSE 0)' 쿼리식의 연산자가 없는 구문 오류입니다.

at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)

at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)

at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)

at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)

at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)

at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)

at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)

at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)

at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior)

at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)

Thanks in advance,

... Mike. ^_^