Mysql - update foreign key with value
I have a date, year, month, day where the "year, month, day" columns are foreign key to other tables I want each parent to get id (year (date of birth)) as the value of the year column and the same for month and day columns.
How do I do this in MySQL?
I tried this solution:
update member set year=(select All_years.id from All_years,member where All_years.fromY=year(member.birthdate)) where id=30471;
but this raises "ERROR 1093 (HY000): you cannot specify the" member "of the target table to update in the FROM clause"
Thank you in advance
+2
source to share