Merging some columns of two mysql tables where id = fileid
Posted
by
garg
on Stack Overflow
See other posts from Stack Overflow
or by garg
Published on 2012-09-12T03:32:59Z
Indexed on
2012/09/12
3:38 UTC
Read the original article
Hit count: 126
There are two tables
TableA
filedata_id | user_id | filename
1 | 1 | file.txt
2 | 1 | file2.txt
TableB
a_id | date | filedataid | counter | state | cat_id | subcat_id | med_id
99 | 1242144 | 1 | 2 | v | 55 | 56 | 90
100 | 1231232 | 2 | 3 | i | 44 | 55 | 110
I want to move columns cat_id, subcat_id, med_id to TableA where tableA.filedata_id = TableB.filedataid
The result should be:
TableA
filedata_id | user_id | filename | cat_id | subcat_id | med_id
1 | 1 | file.txt | 55 | 56 | 90
2 | 1 | file2.txt | 44 | 55 | 110
and so on.
Is there a way to do this easily?
© Stack Overflow or respective owner