Hello,

You need an update query, syntax explained here:

http://dev.mysql.com/doc/refman/5.0/en/update.html

UPDATE user u1, user2 u2
SET u1.login = u2.login, u1.password = u2.password
WHERE u1.username = u2.username

This will work well provided the user names are unique. 

Ellen V. Coen

-----Original Message-----
From: tedd [mailto:[EMAIL PROTECTED]
Sent: Sunday, July 29, 2007 04:05 PM
To: 'MySQL SIG'
Subject: [mysql] A query question

Hi:

The problem:

I have two tables.

Table One (named "user") which has fields:

name,
email,
user_name

Table Two (named "user2"), which has fields:

user_name
login_name
password

What I need to is Table One to have populated fields.

name,
email,
login_name
password

The problem as I see it, is to search Table Two for "user_name" found 
in Table One. Upon finding a match, then transfer "login_name" and 
"password" from Table Two into Table One. I have already set up 
fields with same names in Table One for this.

Considering that this is a one time fix, I don't want to write a 
program for it but rather just to run a SQL query via phpMyAdmin.

I know I could look it up, but I don't want to make a mistake in testing it.

So, if someone would be so kind, please complete the following query for me?

SELECT user_name FROM `user` WHERE ???

Thanks,

tedd


-- 
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com
_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php



_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to