I have three tables in mySQL:
TABLE:CollectionAttributeValues
cID
akID
avID
TABLE: atDefault
avID
value
TABLE: CollectionVersions
cID
cvName
Looks Like
CollectionVersions
cID cvName
1 Billete
5 Tony
atDefault
avID value
1 B.B
3 T.T
CollectionAttributeValues
cID akID avID
1 29 1
5 29 3
I need to take all the values (the column named values) in atDefault”
and put it into cvName in CollectionVersions
WHERE akID = 29 in CollectionAttributeValues
Basically, take “Billette” and change it to “B.B”. AND also take “Tony” and change it to “TT”.
So far I came up with this
SELECT value
FROM `atDefault` AS d
LEFT JOIN `CollectionAttributeValues` AS v ON d.avID = v.avID
WHERE v.akID =29
But I don’t know how to insert the resulting values into the “cvName” column in CollectionVersions…
To
UPDATEall the columns of the tableCollectionVersionswith the data that you get form the query. Try the below query –