I have some trouble trying to get column values from a table to a different table.
I got a table called sorting_orders and a table thats called new_tags and theres a column in sorting_orders thats called orders. Theres also a column in sorting_orders with IDS that match with the IDS from new_tags.
What i need is to get all the values from the column "orders" to a column in new_tags which is called "sorting" while the IDS are matching from both tables.
I tried various querys but usually i get a warning message that says several fields dont have a default value. After I got this warning my entire table went empty except the sorting column.
INSERT INTO new__tags(sorting) SELECT orders FROM sorting_orders the warning i get is Field X doesn't have a default value. after this it just sets it to null while it had a value before
Thank you very much, I appreciate any help.
You are looking for an update by select.
Use this as example:
UPDATE new__tags nt, (SELECT orders FROM sorting_orders so where so.id = 458) src
SET nt.sorting = src.orders where nt.id = 458 ;