Please forgive me if this is a stupid question but I am new to phpadmin exports.
I have database A with table B and I want to copy the username coulmn to databass C table D.
My issue is when I export table B it gives me all values and the structer is not the same in table D. I want to just export the values in username and import them to users in table D. How do I do that? --- I hope that made sense? 😕
Is this MySql or PgSQL or what ?
Most modern SQL implementations allow something like this:
update db1.table set key = (select value from db2.table);
Mysql
I am not sure I understand how to impliment the code you gave. I donot want to copy the whole table only a single value column.
What I am trying to do is copy my users from one script to another but the DB's structures do not match up so I have to import them table value to table value.
Could you possiably give me a little more info?
Well, what are the two db names and field names you want to copy?
well there are serveral I will need to do but if I can just get one done I think I can figure out the rest. here is the layout
I have database 'qdate_qdate' table is 'dt_members' the column I want to copy is 'login'
the db I am copying to is as follows
database 'qdate_date' table is 'odate_user' the column I want to copy to is 'username'
Under what criteria? Is the newer table empty and you just need to get usernames? Do they have to match special user id fields?
The table is empty and I just need to populate each column with data from the old DB. this particular table has 20 columns that I will have to populate 1 at a time. There is an auto incrament number so I am not sure if that messes anyting up.
any ideas zab?
Sorry. I had to take my wife to work. Try this:
update qdate_date.odate_user set username = (select login from qdate_qdate.dt_members);
qdate_date
odate_user
username
login
qdate_qdate
dt_members
I didn't test it, but I am booting up mysqladmin now to give it a shot myself
no worries thanks. I will try it as well
#1242 - Subquery returns more than 1 row
Is this something you are allowed to use php for? Or do you have to have a single query?
If a query is needed, I will have to play around a bit with my sql terminal...
quesry is easiest for me. found a long version of something that works just now. Thank you for working with me though 🙂
Well post it for others who may have the same problem :-)
Plus I am curious now...
INSERT INTO odate_user( id , active , username, password) VALUES ('', '', '', '890778098');
id
active
password
I just exported it then made a long form of the sql query
ok that did not end up wprking because when I move on to the next column it overwrites the previous. I guess I have to write something that checks the username value to make sure it matches before it inserts the data into the column....Back to the drawing board
INSERT SELECT
$sql = "INSERT INTO qdate_date.odate_user (username) SELECT dt_members.login FROM qdate_qdate.dt_members";