0

I have a update query

    update B set B.i_description='travncore testing',B.Tm_id=35 
from backlog B join backToSprint B1 on 
B.b_id=B1.fk_back_id where B1.s_id=18

when run this query i got an error like

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use

near 'from backlog B inner join backToSprint B1 on B.b_id=B1.fk_back_id where B2.s_id=' at line 1

Any help would be greatly appreciated .

Community
  • 1
  • 1
Ezra
  • 247
  • 1
  • 13
  • MySQL relies on a specific syntax. – Strawberry Dec 04 '18 at 06:49
  • You need to remove `from` and your syntax is invalid – flyingfox Dec 04 '18 at 06:49
  • Hi. (Obviously:) This is a faq. Please always google error messages & many clear, concise & specific versions/phrasings of your question/problem/goal with & without your particular strings/names & 'site:stackoverflow.com' & tags & read many answers. Add relevant keywords you discover to your searches. If you don't find an answer then post, using 1 variant search as title & keywords for tags. See the downvote arrow mouseover text. When you do have a non-duplicate code question to post please read & act on [mcve]. – philipxy Dec 04 '18 at 06:53

2 Answers2

2

You can try below set should be afer join and before where clause

update backlog  B  
join backToSprint B1 on B.b_id=B1.fk_back_id 
set B.i_description='travncore testing',B.Tm_id=35
where B1.s_id=18
Fahmi
  • 37,315
  • 5
  • 22
  • 31
1

The right grammer can be found at mysql-update-a-joined-table,so you can try with below

update backlog B
join backToSprint B1 on B.b_id=B1.fk_back_id
set B.i_description='travncore testing',B.Tm_id=35 
where B1.s_id=18
flyingfox
  • 13,414
  • 3
  • 24
  • 39