Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General »

Como puedo fusionar 2 tablas en 1 sola??

Estas en el tema de Como puedo fusionar 2 tablas en 1 sola?? en el foro de Bases de Datos General en Foros del Web. 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 ...
  #1 (permalink)  
Antiguo 09/05/2008, 13:50
Avatar de .FF
.FF
 
Fecha de Ingreso: mayo-2006
Mensajes: 98
Antigüedad: 18 años
Puntos: 1
Pregunta 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???

*Uso phpMyAdmin SQL Dump
-- version 2.11.2.2

__________________
Muchas Gracias :)

*********************
Desde Rusia-Spanish
  #2 (permalink)  
Antiguo 09/05/2008, 15:11
Avatar de xcars  
Fecha de Ingreso: mayo-2005
Ubicación: El Salvador
Mensajes: 753
Antigüedad: 19 años
Puntos: 4
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)
__________________
Con Microaplicaciones puedes hacer tu tienda en línea de forma sencilla y rápida, sin costos ocultos y con mucha responsabilidad.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:47.