SQL语法错误:靠近“。”?

时间:2017-10-13 08:38:53

标签: android sql sqlite android-sqlite

当我尝试运行此查询时:

UPDATE Line_Master 
SET Line_Master.line_count = t2.task_count FROM (SELECT COUNT (am.line_id) AS task_count, lm.lineId
   FROM Assets_Master am,Line_Master lm,Section_Master sm,Task_Point_Master tpm,Task_Master TM
   WHERE (lm.line_id = am.line_id)
     AND (am.asset_id = sm.asset_id)
     AND (sm.section_id = tpm.section_id)
     AND (tm.task_point_id = tpm.task_point_id)
   GROUP BY lm.line_id) t2
WHERE Line_Master.line_id = t2.lineId

我收到此错误:

内部错误 语法错误:“。”附近:语法错误

1 个答案:

答案 0 :(得分:2)

我不知道你要做什么,但这样语法是正确的。但我不知道它是否显示了你想要的结果,以及sqlite是否支持这个......

UPDATE Line_Master 
SET Line_Master.line_count = (SELECT t2.task_count FROM (SELECT COUNT (am.line_id) AS task_count, lm.lineId
   FROM Assets_Master am,Line_Master lm,Section_Master sm,Task_Point_Master tpm,Task_Master TM
   WHERE (lm.line_id = am.line_id)
     AND (am.asset_id = sm.asset_id)
     AND (sm.section_id = tpm.section_id)
     AND (tm.task_point_id = tpm.task_point_id)
   GROUP BY lm.line_id) t2
   WHERE Line_Master.line_id = t2.lineId)