开发者

SQL query syntax error

I got a syntax error on this query, but I don't know what I'm doing wrong.

UPDATE `jos_planning2_rosters` r
LEFT JOIN jos_planning2_rosters_setup s ON r.id = s.roster_id
LEFT JOIN jos_planning2_workplaces w ON s.workplace_id = w.id
WHERE r.roster_state =1
AND s.card_id IS NULL
AND s.type_id = '2'
AND r.roster_date >= DATE( NOW()) SET s.card_id = '1', s.type_i开发者_运维知识库d = '1' 
WHERE s.type_id = '2', s.card_id IS NULL, r.id = '8';


You have two WHERE clauses in your query.


Are you trying to do this, the query is a mess:

UPDATE s
SET    s.card_id = '1', 
       s.type_id = '1'
From   jos_planning2_rosters_setup s
       INNER JOIN jos_planning2_rosters r ON r.id = s.roster_id
WHERE  r.roster_state = 1
       AND s.card_id IS NULL
       AND s.type_id = '2'
       AND r.roster_date >= GetDate()
       AND r.id = '8';


Try it without those backticks around jos_planning2_rosters.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜