0

I've my table user_data that has over 8k records. Then I have my table Geo_location. Both tables join on the member_num column

Geo_location has a column called public that should match the table user_data column acceptinClients. Its an INT 0 or 1

I am having some data consistency problem and not all record match. I know how to do a long winded fetch and do one by one update in PHP if they dont match.

But I was wondering if there is a way to create a SQL query that will loop through all records in Geo_location - public and update them with whatever value is in user_data - acceptinClients

Is there a way to do that or am i asking too much? if so, how? i have been reading around but cant find a simple solution for my problem or dont understand them

Jonathan Thurft
  • 4,087
  • 7
  • 47
  • 78
  • Voting to leave open based on http://meta.stackexchange.com/questions/139961/whats-the-policy-on-closing-unique-questions-with-overlapping-but-non-duplicat – Jan Doggen Jan 26 '14 at 19:49

1 Answers1

1

I don't know if I understand the problem, but isn't

UPDATE Geo_location AS g 
JOIN users_data AS u ON u.member_num = g.member_num 
SET g.public = ud.acceptinClients

correct?

marcosh
  • 8,780
  • 5
  • 44
  • 74