0

I'm not good at coding at all so I need some help in figuring this out.

I have two tables one named 'registration' and one named 'users'.

In the 'registration' table i have a field called "officers name" which is filled with integers ranging from 1 to 40. These values correspond to "User ID" (primary key) value in the 'users' table, which corresponds to a persons name in the "full name" field.

What I need to be able to do is have whatever the value is in the "officers name" field, replace it with whatever value is in the "Full name" field with the corresponding integer value.

my issue is that there are 1400 entries, and these values repeat multiple times, so I'm not even sure how I would go about doing that.

Anyone have any ideas?

  • This is a basic `join` query. I suggest that you learn about the SQL language if you are planning on using it. – Gordon Linoff Jun 15 '14 at 14:03
  • As said above, I suggest you look up `JOIN` query syntax and then modify your question to show us the query you come up with - if you are still having trouble figuring it out :) – justanotherdev Jun 15 '14 at 14:05
  • Duplicate? http://stackoverflow.com/questions/5727827/update-one-mysql-table-with-values-from-another – bloodyKnuckles Jun 15 '14 at 14:06

1 Answers1

0

Something like this to get you started:

SELECT     u.fullName
FROM       users u
INNER JOIN registration r ON (u.userID = r.userID)
Caleb Palmquist
  • 448
  • 2
  • 7
  • 15
  • Thank you but out of curiousity (u.userID = r.userID) should the r.userID be the name of the field of the registration table where these numbers are? since there is no user ID field in the registration table? – user3554257 Jun 15 '14 at 14:27
  • @bloodyKnuckles I looked at that, and I am uncertain, but that didn't help me because of the fact that my two tables do not have the same field names, in addition I am not just trying to move data from one tables column to another, its a bit more complicated since the data in one table corresponds to the primary key in another table, of which I want to replace the data from the "full name" field for that primary key (user id) with the corresponding number in the other table. – user3554257 Jun 15 '14 at 14:44