We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

copy ids from tableA into tableB

XK8ER
XK8ER asked
on
Medium Priority
234 Views
Last Modified: 2012-05-06
hello there,

how can I update and have the same data from

table post in column postid into -> table thread in column threadid
CREATE TABLE `post` (
  `postid` int(10) unsigned NOT NULL auto_increment,
  `threadid` int(10) unsigned NOT NULL default '0',
  `parentid` int(10) unsigned NOT NULL default '0',
  `username` varchar(100) NOT NULL default '',
  `userid` int(10) unsigned NOT NULL default '0',
  `title` varchar(250) NOT NULL default '',
  `dateline` int(10) unsigned NOT NULL default '0',
  `pagetext` mediumtext,
  `allowsmilie` smallint(6) NOT NULL default '0',
  `showsignature` smallint(6) NOT NULL default '0',
  `ipaddress` char(15) NOT NULL default '',
  `iconid` smallint(5) unsigned NOT NULL default '0',
  `visible` smallint(6) NOT NULL default '0',
  `attach` smallint(5) unsigned NOT NULL default '0',
  `infraction` smallint(5) unsigned NOT NULL default '0',
  `reportthreadid` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`postid`),
  KEY `userid` (`userid`),
  KEY `threadid` (`threadid`,`userid`),
  FULLTEXT KEY `title` (`title`,`pagetext`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;
 
CREATE TABLE `thread` (
  `threadid` int(10) unsigned NOT NULL auto_increment,
  `title` varchar(250) NOT NULL default '',
  `prefixid` varchar(25) NOT NULL default '',
  `firstpostid` int(10) unsigned NOT NULL default '0',
  `lastpostid` int(10) unsigned NOT NULL default '0',
  `lastpost` int(10) unsigned NOT NULL default '0',
  `forumid` smallint(5) unsigned NOT NULL default '0',
  `pollid` int(10) unsigned NOT NULL default '0',
  `open` smallint(6) NOT NULL default '0',
  `replycount` int(10) unsigned NOT NULL default '0',
  `hiddencount` int(10) unsigned NOT NULL default '0',
  `deletedcount` int(10) unsigned NOT NULL default '0',
  `postusername` varchar(100) NOT NULL default '',
  `postuserid` int(10) unsigned NOT NULL default '0',
  `lastposter` char(50) NOT NULL default '',
  `dateline` int(10) unsigned NOT NULL default '0',
  `views` int(10) unsigned NOT NULL default '0',
  `iconid` smallint(5) unsigned NOT NULL default '0',
  `notes` varchar(250) NOT NULL default '',
  `visible` smallint(6) NOT NULL default '0',
  `sticky` smallint(6) NOT NULL default '0',
  `votenum` smallint(5) unsigned NOT NULL default '0',
  `votetotal` smallint(5) unsigned NOT NULL default '0',
  `attach` smallint(5) unsigned NOT NULL default '0',
  `similar` varchar(55) NOT NULL default '',
  `taglist` mediumtext,
  `vbseo_linkbacks_no` int(10) unsigned NOT NULL default '0',
  `time_check` int(10) NOT NULL default '0',
  `ignore_check` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`threadid`),
  KEY `postuserid` (`postuserid`),
  KEY `pollid` (`pollid`),
  KEY `forumid` (`forumid`,`visible`,`sticky`,`lastpost`),
  KEY `lastpost` (`lastpost`,`forumid`),
  KEY `dateline` (`dateline`),
  KEY `prefixid` (`prefixid`,`forumid`),
  FULLTEXT KEY `title` (`title`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

Open in new window

Comment
Watch Question

Commented:
use this method
insert into thread (threadid) select postid from post

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
SharathData Engineer
CERTIFIED EXPERT

Commented:
can you explain with an example?
Agamal is right

Commented:
did this work for you or not yet :D
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.