GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Need MySQL help with short query.. (https://gfy.com/showthread.php?t=906554)

Pics Traffic 05-21-2009 08:03 PM

Need MySQL help with short query..
 
I have two tables A and B. I want update table A with all entries from table B. Tables have different structures but 2 colums that I want to copy are the same. Help brother out.

rowan 05-21-2009 09:05 PM

If you're ever scratching your head about a command, do a search for "COMMAND mysql" and the mysql site is usually the first result.

I presume you want something like this...

INSERT INTO table_B (column1,column2) SELECT column1,column2 FROM table_A;

Back up your data first.

Pics Traffic 05-21-2009 09:50 PM

Quote:

Originally Posted by rowan (Post 15878020)
If you're ever scratching your head about a command, do a search for "COMMAND mysql" and the mysql site is usually the first result.

I presume you want something like this...

INSERT INTO table_B (column1,column2) SELECT column1,column2 FROM table_A;

Back up your data first.

sorry, I should have added that I need to do UPDATE not insert because there's a default value in that field already. I looked all over but still can't figure out what Im doing wrong.

Pics Traffic 05-21-2009 10:05 PM

Ok, case closed. Figured it out.

rowan 05-21-2009 10:24 PM

So what was the answer? :) REPLACE INTO?

Iron Fist 05-21-2009 10:43 PM

Love these threads...

HELP ME HELP ME...

Okay FUCK OFF... I GOT IT...

Yeech... at least post what you did that fixed it.

Pics Traffic 05-21-2009 11:01 PM

Quote:

Originally Posted by rowan (Post 15878178)
So what was the answer? :) REPLACE INTO?

no, just update.. I was overdoing it. It was easy one.

UPDATE videos v, banners b SET v.BANNER_NAME = b.BANNER_NAME, v.BANNER_URL = b.BANNER_URL WHERE v.VIDEOID = b.VIDEOID


All times are GMT -7. The time now is 03:15 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123