Re: [PHP] Join question
- From: tedd.sperling@xxxxxxxxx (tedd)
- Date: Thu, 29 Nov 2007 16:42:38 -0500
At 4:11 PM -0500 11/29/07, Robert Cummings wrote:
Grep? Loop? A single query will suffice. Also, he doesn't mention
wanting to clobber the passwords in table1 when the username does
already exist.
Cheers,
Rob.
Table1 passwords and logins are not populated. I want to take those appearing in Table2 and place them in Table1.
Then, I need to take all the entries that are in Table2, but not in Table2, and add them to Table1.
I think (could be wrong) it's going to be a two pass operation. First, to transfer values to records in the target table (user1) that have common username with the source table (user2); Second, to add records from the source table (user2) that don't are not found in the target table (user1).
user1 Table
username <-- common to both tables
login <-- needs to be populated
password <-- needs to be populated
user2 Table
username <-- common to both tables
login <-- has data
password <-- has data
I thought that --
UPDATE user1 u1, user2 u2
SET u1.login = u2.login, u1.password = u2.password
WHERE u1.username = u2.username
-- would work, but it don't.
Once I can transfer the known data, then I can work on increasing the number of entries that are found in user2 but are absent in user1.
Still floundering.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
.
- Follow-Ups:
- Re: [PHP] Join question [solved]
- From: tedd
- Re: [PHP] Join question [solved]
- References:
- Re: [PHP] Join question
- From: Wolf
- Re: [PHP] Join question
- From: Robert Cummings
- Re: [PHP] Join question
- Prev by Date: Re: [PHP] Join question
- Next by Date: parsing text for special characters
- Previous by thread: Re: [PHP] Join question
- Next by thread: Re: [PHP] Join question [solved]
- Index(es):