I've two MySQL tables a and b with fields x and y. Table b has 1 extra area z. Table a is within database db1 and b is within db2. I wish to copy x and y from one place to another and hang a static value for z. How do i do this ?
db1.a.x -> db2.b.x db1.a.y -> db2.b.y 4 -> db2.b.z
To date I've:
"INSERT INTO db2.b (x,y) SELECT x,y FROM db1.a"
How do you set db2.b.z to 4 ? I don't want to create a lasting default variable for that table.
SELECT 4 provides you with
4, so try:
INSERT INTO db2.b (x,y,z) SELECT x,y,4 FROM db1.a
INSERT INTO db2.b (x, y, z) SELECT x, y, 4 FROM db1.a;