M
M
My joy2014-08-31 17:18:25
MySQL
My joy, 2014-08-31 17:18:25

Mysql update one table with data from another how?

here is the code:

update
  table_a, table_b
set 
  table_a.column1 = table_b.column1,
  table_a.column2 = table_b.column2
where
  table_a.column3 = table_b.column3
limit 1

gives the following error:
1121: Incorrect usage of UPDATE and LIMIT
Tell me then how to write it correctly.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
My joy, 2014-08-31
@t-alexashka

It turns out you can't use LIMIT when UPDATE a table with data from another table...

A
Alexander Karabanov, 2014-09-01
@karabanov

Write a stored procedure.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question