Foros del Web

Foros del Web (http://www.forosdelweb.com/)
-   Bases de Datos General (http://www.forosdelweb.com/f21/)
-   -   Como puedo fusionar 2 tablas en 1 sola?? (http://www.forosdelweb.com/f21/como-puedo-fusionar-2-tablas-1-sola-584765/)

.FF 09/05/2008 13:50

Como puedo fusionar 2 tablas en 1 sola??
 
Tengo una tabla: post_parsed que contiene datos como:
Código:

--
-- Estructura de tabla para la tabla `vb_postparsed`
--

DROP TABLE IF EXISTS `vbulletin_postparsed`;
CREATE TABLE IF NOT EXISTS `vbulletin_postparsed` (
  `postid` int(10) unsigned NOT NULL default '0',
  `dateline` int(10) unsigned NOT NULL default '0',
  `styleid_code` int(11) NOT NULL default '-1',
  `styleid_html` int(11) NOT NULL default '-1',
  `styleid_php` int(11) NOT NULL default '-1',
  `styleid_quote` int(11) NOT NULL default '-1',
  `hasimages` smallint(6) NOT NULL default '0',
  `pagetext_html` mediumtext,
  PRIMARY KEY  (`postid`,`styleid_code`,`styleid_html`,`styleid_php`,`styleid_quote`),
  KEY `dateline` (`dateline`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Volcar la base de datos para la tabla `vbulletin_postparsed`
--

INSERT INTO `vbulletin_postparsed` (`postid`, `dateline`, `styleid_code`, `styleid_html`, `styleid_php`, `styleid_quote`, `hasimages`, `pagetext_html`) VALUES
(12696, 1174181335, -1, -1, -1, -1, 0, 'esta es mi aporte de...................
..............ETC ETC ETC ETC ETC ETC ETC ETC ...............

Y una segunda Tabla:
Código:

--
-- Estructura de tabla para la tabla `vbulletin_post_parsed`
--

DROP TABLE IF EXISTS `vbulletin_post_parsed`;
CREATE TABLE IF NOT EXISTS `vbulletin_post_parsed` (
  `postid` int(10) unsigned NOT NULL default '0',
  `dateline` int(10) unsigned NOT NULL default '0',
  `styleid_code` int(11) NOT NULL default '-1',
  `styleid_html` int(11) NOT NULL default '-1',
  `styleid_php` int(11) NOT NULL default '-1',
  `styleid_quote` int(11) NOT NULL default '-1',
  `hasimages` smallint(6) NOT NULL default '0',
  `pagetext_html` mediumtext,
  PRIMARY KEY  (`postid`,`styleid_code`,`styleid_html`,`styleid_php`,`styleid_quote`),
  KEY `dateline` (`dateline`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Volcar la base de datos para la tabla `vb_post_parsed`
--

INSERT INTO `vbulletin_post_parsed` (`postid`, `dateline`, `styleid_code`, `styleid_html`, `styleid_php`, `styleid_quote`, `hasimages`, `pagetext_html`) VALUES
(26671, 1209343910, -1, -1, -1, -1, 1, '<a href="http://i17...................
..............ETC ETC ETC ETC ETC ETC ETC ETC ...............

(AMBAS SON POST DE UN FORO)

LO QUE QUIERO ES pasar los datos (post) de la tabla 'vb_postparsed' a la tabla' vb_post_parsed' que quede 1 sola tabla (vb_post_parsed) pero con todos los datos correctos de ambas tablas...


¿¿¿POR FAVOR COMO HAGO ESO??? :borracho:

*Uso phpMyAdmin SQL Dump
-- version 2.11.2.2


xcars 09/05/2008 15:11

Re: Como puedo fusionar 2 tablas en 1 sola??
 
1) crea la tabla con los campos de la union entre ambas tablas
2) Un insert con un select a ambas tablas y listos (where tabla1.micampo_id=tabla2.micampo_id)


La zona horaria es GMT -6. Ahora son las 08:45.

Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.