Ayuda con Cambio de Tabla MySQL

  • Autor Autor blogers
  • Fecha de inicio Fecha de inicio
B

blogers

Pi
SEO
Hola colegas pues tengo un problema no puedo pasar mi tabla a una nueva con diferentes campos alguien que me pueda ayudarç

tengo asi me tabla antigua

INSERT tabla_nueva (necesita un valor, campo, campo)

SELECT el valor que doy, campo igual, campo igual

FROM tabla_antigua;

son 45 campos pero puse ejemplo solo 3 pero no logro hacer que pase datos y que de valor a los nuevos e iguales campos

alguna ayua que me den gracias
 
INSERT INTO tabla_nueva(campos) SELECT (campos) FROM tabla_antigua

No se si te has equivocado al escribir pero te falta el "INTO" :encouragement:
 
Lo tengo asi pero no funciona

INSERT tabla_nueva( account_id, plan_id, transaction_id, moved_from, email, reciprocal, recip_valid, ip_address, listing_header, status, pagerank, rank, date_del, last_modified, clicks, partner, partner_start, featured, featured_start, sponsored, sponsored_start, expire_date, expire_notif, expire_action, expire_salt, duplicate, last_check_date, cron_cycle, fav_accounts_set, meta_description, meta_keywords, domain, url, title, description, date, category_id, country, company, city, location, latutud, longitude, link, prefijo)


SELECT 0, 0, 0, -1, mail@hotmail.com, http://, 0, 201.150.66.72, 0, active, 0, 0, 0000-00-00 00:00:00, 0000-00-00 00:00:00, 0, 0, 0000-00-00 00:00:00, 0, 0000-00-00 00:00:00, 0, 0000-00-00 00:00:00, 0000-00-00 00:00:00, 0, , , 0, 0000-00-00 00:00:00, 0, , , , , http://, title, description, 0000-00-00 00:00:00, 57, 1, company, city, location, latitude, longitude, link, AU
FROM tabla_antigua;


INSERT INTO tabla_nueva(campos) SELECT (campos) FROM tabla_antigua

No se si te has equivocado al escribir pero te falta el "INTO" :encouragement:
 
INSERT INTO tabla_nueva( account_id, plan_id, transaction_id, moved_from, email, reciprocal, recip_valid, ip_address, listing_header, status, pagerank, rank, date_del, last_modified, clicks, partner, partner_start, featured, featured_start, sponsored, sponsored_start, expire_date, expire_notif, expire_action, expire_salt, duplicate, last_check_date, cron_cycle, fav_accounts_set, meta_description, meta_keywords, domain, url, title, description, date, category_id, country, company, city, location, latutud, longitude, link, prefijo)


SELECT 0, 0, 0, -1, mail@hotmail.com, http://, 0, 201.150.66.72, 0, active, 0, 0, 0000-00-00 00:00:00, 0000-00-00 00:00:00, 0, 0, 0000-00-00 00:00:00, 0, 0000-00-00 00:00:00, 0, 0000-00-00 00:00:00, 0000-00-00 00:00:00, 0, , , 0, 0000-00-00 00:00:00, 0, , , , , http://, title, description, 0000-00-00 00:00:00, 57, 1, company, city, location, latitude, longitude, link, AU
FROM tabla_antigua;

Prueba asi
 
INSERT INTO tabla_nueva( account_id, plan_id, transaction_id, moved_from, email, reciprocal, recip_valid, ip_address, listing_header, status, pagerank, rank, date_del, last_modified, clicks, partner, partner_start, featured, featured_start, sponsored, sponsored_start, expire_date, expire_notif, expire_action, expire_salt, duplicate, last_check_date, cron_cycle, fav_accounts_set, meta_description, meta_keywords, domain, url, title, description, date, category_id, country, company, city, location, latutud, longitude, link, prefijo)


SELECT 0, 0, 0, -1, mail@hotmail.com, http://, 0, 201.150.66.72, 0, active, 0, 0, 0000-00-00 00:00:00, 0000-00-00 00:00:00, 0, 0, 0000-00-00 00:00:00, 0, 0000-00-00 00:00:00, 0, 0000-00-00 00:00:00, 0000-00-00 00:00:00, 0, , , 0, 0000-00-00 00:00:00, 0, , , , , http://, title, description, 0000-00-00 00:00:00, 57, 1, company, city, location, latitude, longitude, link, AU
FROM tabla_antigua;

Prueba asi
 
Muchas gracias colega me sacaste de un gran apuro
INSERT INTO tabla_nueva( account_id, plan_id, transaction_id, moved_from, email, reciprocal, recip_valid, ip_address, listing_header, status, pagerank, rank, date_del, last_modified, clicks, partner, partner_start, featured, featured_start, sponsored, sponsored_start, expire_date, expire_notif, expire_action, expire_salt, duplicate, last_check_date, cron_cycle, fav_accounts_set, meta_description, meta_keywords, domain, url, title, description, date, category_id, country, company, city, location, latutud, longitude, link, prefijo)


SELECT 0, 0, 0, -1, mail@hotmail.com, http://, 0, 201.150.66.72, 0, active, 0, 0, 0000-00-00 00:00:00, 0000-00-00 00:00:00, 0, 0, 0000-00-00 00:00:00, 0, 0000-00-00 00:00:00, 0, 0000-00-00 00:00:00, 0000-00-00 00:00:00, 0, , , 0, 0000-00-00 00:00:00, 0, , , , , http://, title, description, 0000-00-00 00:00:00, 57, 1, company, city, location, latitude, longitude, link, AU
FROM tabla_antigua;

Prueba asi
 
Atrás
Arriba