Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

My query:

DELETE a FROM TR_ContactResultRecord  a
INNER JOIN TR_Case  b on (a.FireStationCode=b.FireStationCode and a.CaseNo=b.CaseCode )
WHERE b.Update_DateTime <=20140628134416

It show error: [Err] 1 - near "a": syntax error

How delete table inner join with other table in Sqlite?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
405 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try to rewrite you query using subquery: In case your PK for TR_ContactResultRecord is CaseNo

DELETE FROM TR_ContactResultRecord
WHERE CaseNo IN (
  SELECT CaseNo FROM TR_ContactResultRecord a
  INNER JOIN TR_Case b
    ON (a.FireStationCode=b.FireStationCode and a.CaseNo=b.CaseCode )
  WHERE b.Update_DateTime <=20140628134416
);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...