Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update rows cell from another table by matching IDs [duplicate]

Tags:

sql

php

mysql

Hi i have two tables ...

Acctive table:

SELECT * FROM 36496839_radioamater.skladovekarty00006;

CISLO    NAME
1        NULL
2        NULL
3        NULL                  (other cells)
4        NULL
5        NULL

Helpfull table

SELECT * FROM 36496839_radioamater.skladovekarty00008;

CISLO    NAME
1        one
4        four
3        tree                  (other cells)

And i need create a SQL code which find first row from table00008 in table00006 and copy value in NAME by matching CISLO

result:

CISLO    NAME
1        one
2        NULL
3        tree                  (other cells)
4        four
5        NULL

and thus need to remodel an additional 12 000 rows

Can anyone help me I have desperately Thx, Martin

like image 810
user3646072 Avatar asked Sep 30 '22 19:09

user3646072


1 Answers

update 36496839_radioamater.skladovekarty00006 d
join 36496839_radioamater.skladovekarty00008 s on s.CISLO = d.CISLO
set d.NAME = s.NAME
like image 53
juergen d Avatar answered Oct 10 '22 00:10

juergen d