Retroceder   Foros del Web > Programación para sitios web > Bases de Datos

Respuesta
 
Herramientas Desplegado
Antiguo 09-may-2008, 13:50   #1 (permalink)
.FF
.FF está en el buen camino
 
Avatar de .FF
 
Fecha de Ingreso: mayo-2006
Mensajes: 77
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
.FF está desconectado   Responder Citando
Antiguo 09-may-2008, 15:11   #2 (permalink)
xcars sólo puede mejorar
 
Avatar de xcars
 
Fecha de Ingreso: mayo-2005
Mensajes: 500
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)
__________________
QUE NADIE ME HABLE QUE NO SEA SUBVERSIVO
xcars está desconectado   Responder Citando
Respuesta
No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 16:04.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93