SQLDF错误 - 语法错误

时间:2011-09-14 20:34:51

标签: sql r sqldf

我正在运行以下命令:

sqldf("SELECT * FROM dat WHERE Form LIKE '%compare%' AND Create.Date LIKE '%7/01/11%' AND Post.Status = 'Success'")

但最终收到以下错误。

Error in sqliteExecStatement(con, statement, bind.data) : 
  RS-DBI driver: (error in statement: near "Create": syntax error)

谁能告诉我发生了什么事。

> str(dat)
'data.frame':   23 obs. of  12 variables:
 $ ID            : int  4873 4874 4890 4893 4895 4902 4904 4905 4906 4921 ...
 $ Name          : Factor w/ 18 levels "Casey Ryan","Elizabeth Cullen",..: 13 9 15 15 16 15 15 15 16 12 ...
 $ Create.Date   : Factor w/ 23 levels "03:23.0","14:43.0",..: 3 15 20 13 23 6 12 14 21 4 ...
 $ In.Click.ID   : int  32787 32788 13480 21050 21041 32824 27807 27806 15350 32911 ...
 $ Traffic.Source: Factor w/ 3 levels "FACEBOOK","GOOGLE",..: 3 3 1 3 2 3 3 3 2 3 ...
 $ Refer.Domain  : Factor w/ 7 levels "","autoinsurancestep",..: 3 2 7 1 2 4 4 2 5 4 ...
 $ Form          : Factor w/ 3 levels "","autoinsurancestep",..: 2 1 1 1 3 3 3 3 1 3 ...
 $ Keyword       : Factor w/ 3 levels "","{keyword}",..: 1 1 2 1 3 1 1 1 2 1 ...
 $ Ping.Status   : Factor w/ 2 levels "","Success": 1 2 1 1 1 2 1 1 1 2 ...
 $ Post.Status   : Factor w/ 2 levels "","Success": 1 2 1 1 1 2 1 1 1 2 ...
 $ Buyer         : Factor w/ 8 levels "","ALL_WEB_LEADS",..: 1 6 1 1 1 7 1 1 1 8 ...
 $ Amount        : int  0 217 0 0 0 3000 0 0 0 1200 ...

1 个答案:

答案 0 :(得分:1)

在SQL中,一个点将数据库名称与表名分开。因此,不要在名称中使用点。