早安全部
我今天早上一直在研究这些论坛,但我们没有能够回答我的问题。
我正在尝试使用phpmyadmin将同一数据库中的所有数据从一个表提取到另一个表中。
这些信息汇集在一起,用于一个人的身份。但我希望将所有信息都放在一个表格中。这样我就可以轻松地将信息导出到csv文件中。
似乎我可以移动或导出信息。
但是,我的主要问题是这个。
我需要系统意识到来自两个表的相同ID的信息需要合并在一起,只剩下一个id。两个表中唯一的共享信息是ID?
有人能够指出我如何实现这个目标的正确方向吗?
提前感谢您的任何帮助
只是添加表结构。
表1: -
表jos_cck_store_form_delegate的表结构
色谱柱 类型 空值 默认 ID INT(11) 否
delegate_title VARCHAR(255) 否
DELEGATE_FIRST_NAME VARCHAR(255) 否
delegate_last_name VARCHAR(255) 否
delegate_institution VARCHAR(255) 否
delegate_role VARCHAR(255) 否
delegate_email VARCHAR(255) 否
delegate_email_copy VARCHAR(255) 否
delegate_phone VARCHAR(255) 否
delegate_address 文本 否
delegate_partner VARCHAR(255) 否
delegate_diet VARCHAR(255) 否
delegate_access VARCHAR(255) 否
delegate_bio VARCHAR(255) 否
标题 VARCHAR(255) 否
delegate_tests VARCHAR(255) 否
delegate_postal_address 文本 否
delegate_delivery_telephone VARCHAR(255) 否
delegate_wednesday_accom VARCHAR(255) 否
delegate_thursday_accomodation VARCHAR(255) 否
delegate_friday_accomodation VARCHAR(255) 否
delegate_saturday_accomodation VARCHAR(255) 否
delegate_sunday_accomodation VARCHAR(255) 否
delegate_accomodation_notes 文本 否
delegate_meal_requirements VARCHAR(255) 否
delegate_wednesday_dinner VARCHAR(255) 否
delegate_thursday_breakfast VARCHAR(255) 否
delegate_thursday_lunch VARCHAR(255) 否
delegate_thursday_dinner VARCHAR(255) 否
delegate_friday_breakfast VARCHAR(255) 否
delegate_friday_lunch VARCHAR(255) 否
delegate_friday_dinner VARCHAR(255) 否
delegate_saturday_breakfast VARCHAR(255) 否
delegate_saturday_lunch VARCHAR(255) 否
delegate_saturday_dinner VARCHAR(255) 否
delegate_sunday_breakfast VARCHAR(255) 否
delegate_sunday_lunch VARCHAR(255) 否
delegate_sunday_dinner VARCHAR(255) 否
delegate_monday_breakfast VARCHAR(255) 否
delegate_travel VARCHAR(255) 否
delegate_flight_arrival VARCHAR(255) 否
delegate_arrival_flight_number VARCHAR(255) 否
delegate_flight_arrival_time VARCHAR(255) 否
delegate_flight_origin VARCHAR(255) 否
delegate_flight_arrival_airport_and_terminal VARCHAR(255) 否
delegate_car_pickup VARCHAR(255) 否
delegate_arrival_car_address VARCHAR(255) 否
delegate_arrival_train_station VARCHAR(255) 否
delegate_arrival_train_time VARCHAR(255) 否
delegate_arrival_train_station_of_origin VARCHAR(255) 否
delegate_car_pickup_address_thursday 文本 否
delegate_car_pickup_time_thursday VARCHAR(255) 否
delegate_car_pickup_address_friday VARCHAR(255) 否
delegate_car_pickup_time_friday VARCHAR(255) 否
delegate_car_pickup_address_saturday 文本 否
delegate_car_pickup_time_saturday VARCHAR(255) 否
delegate_car_pickup_address_sunday 文本 否
delegate_car_pickup_time_sunday VARCHAR(255) 否
delegate_car_parking_arrival_time VARCHAR(255) 否
delegate_car_parking_days VARCHAR(255) 否
delegate_parking_thursday VARCHAR(255) 否
delegate_parking_friday VARCHAR(255) 否
delegate_parking_saturday VARCHAR(255) 否
delegate_parking_sunday VARCHAR(255) 否
delegate_photo VARCHAR(255) 否
表2 表jos_cck_store_item_content
的表结构色谱柱 类型 空值 默认 ID INT(11) 否
CCK VARCHAR(50) 否
DELEGATE_FIRST_NAME VARCHAR(255) 否
delegate_test VARCHAR(255) 否
delegate_accomodation VARCHAR(255) 否
delegate_train_car_pickup_time VARCHAR(255) 否
delegate_train_car_pickup_address VARCHAR(255) 否
delegate_flight_departure_airline VARCHAR(255) 否
delegate_departure_flight_number VARCHAR(255) 否
delegate_flight_departure_time VARCHAR(255) 否
delegate_flight_departure_airport_and_terminal VARCHAR(255) 否
delgates_departure_destination_airport VARCHAR(255) 否
delegate_departure_train_station VARCHAR(255) 否
delegate_train_departure_time VARCHAR(255) 否
departure_destination_train_station VARCHAR(255) 否
delegate_train_departure_pickup_address VARCHAR(255) 否
delegate_flight_departure_pickup_address 文本 否
delegate_bio 文本 否
introtext 文本 否
答案 0 :(得分:0)
尝试使用此SQL从现有数据创建新表(已加入) - 该表称为“newTable”,您可以将此名称更改为您需要的任何内容。您应该能够看到我们在输出和顺序中指定了我们想要的每一列 - 您可以根据需要更改它。如果你正在大量摆弄数据并且它是“固定的”,即新记录没有一直添加,那么最好将这些数据导出到电子表格中并在那里玩。这里有大量的代码:
CREATE TABLE newTable (
SELECT
jos_cck_store_form_delegate.id,
jos_cck_store_form_delegate.delegate_title,
jos_cck_store_form_delegate.delegate_first_name,
jos_cck_store_form_delegate.delegate_last_name,
jos_cck_store_form_delegate.delegate_institution,
jos_cck_store_form_delegate.delegate_role,
jos_cck_store_form_delegate.delegate_email,
jos_cck_store_form_delegate.delegate_email_copy,
jos_cck_store_form_delegate.delegate_phone,
jos_cck_store_form_delegate.delegate_address,
jos_cck_store_form_delegate.delegate_partner,
jos_cck_store_form_delegate.delegate_diet,
jos_cck_store_form_delegate.delegate_access,
jos_cck_store_form_delegate.delegate_bio,
jos_cck_store_form_delegate.title,
jos_cck_store_form_delegate.delegate_tests,
jos_cck_store_form_delegate.delegate_postal_address,
jos_cck_store_form_delegate.delegate_delivery_telephone,
jos_cck_store_form_delegate.delegate_wednesday_accom,
jos_cck_store_form_delegate.delegate_thursday_accomodation,
jos_cck_store_form_delegate.delegate_friday_accomodation,
jos_cck_store_form_delegate.delegate_saturday_accomodation,
jos_cck_store_form_delegate.delegate_sunday_accomodation,
jos_cck_store_form_delegate.delegate_accomodation_notes,
jos_cck_store_form_delegate.delegate_meal_requirements,
jos_cck_store_form_delegate.delegate_wednesday_dinner,
jos_cck_store_form_delegate.delegate_thursday_breakfast,
jos_cck_store_form_delegate.delegate_thursday_lunch,
jos_cck_store_form_delegate.delegate_thursday_dinner,
jos_cck_store_form_delegate.delegate_friday_breakfast,
jos_cck_store_form_delegate.delegate_friday_lunch,
jos_cck_store_form_delegate.delegate_friday_dinner,
jos_cck_store_form_delegate.delegate_saturday_breakfast,
jos_cck_store_form_delegate.delegate_saturday_lunch,
jos_cck_store_form_delegate.delegate_saturday_dinner,
jos_cck_store_form_delegate.delegate_sunday_breakfast,
jos_cck_store_form_delegate.delegate_sunday_lunch,
jos_cck_store_form_delegate.delegate_sunday_dinner,
jos_cck_store_form_delegate.delegate_monday_breakfast,
jos_cck_store_form_delegate.delegate_travel,
jos_cck_store_form_delegate.delegate_flight_arrival,
jos_cck_store_form_delegate.delegate_arrival_flight_number,
jos_cck_store_form_delegate.delegate_flight_arrival_time,
jos_cck_store_form_delegate.delegate_flight_origin,
jos_cck_store_form_delegate.delegate_flight_arrival_airport_and_terminal,
jos_cck_store_form_delegate.delegate_car_pickup,
jos_cck_store_form_delegate.delegate_arrival_car_address,
jos_cck_store_form_delegate.delegate_arrival_train_station,
jos_cck_store_form_delegate.delegate_arrival_train_time,
jos_cck_store_form_delegate.delegate_arrival_train_station_of_origin,
jos_cck_store_form_delegate.delegate_car_pickup_address_thursday,
jos_cck_store_form_delegate.delegate_car_pickup_time_thursday,
jos_cck_store_form_delegate.delegate_car_pickup_address_friday,
jos_cck_store_form_delegate.delegate_car_pickup_time_friday,
jos_cck_store_form_delegate.delegate_car_pickup_address_saturday,
jos_cck_store_form_delegate.delegate_car_pickup_time_saturday,
jos_cck_store_form_delegate.delegate_car_pickup_address_sunday,
jos_cck_store_form_delegate.delegate_car_pickup_time_sunday,
jos_cck_store_form_delegate.delegate_car_parking_arrival_time,
jos_cck_store_form_delegate.delegate_car_parking_days,
jos_cck_store_form_delegate.delegate_parking_thursday,
jos_cck_store_form_delegate.delegate_parking_friday,
jos_cck_store_form_delegate.delegate_parking_saturday,
jos_cck_store_form_delegate.delegate_parking_sunday,
jos_cck_store_form_delegate.delegate_photo,
jos_cck_store_item_content.cck,
jos_cck_store_item_content.delegate_test,
jos_cck_store_item_content.delegate_accomodation,
jos_cck_store_item_content.delegate_train_car_pickup_time,
jos_cck_store_item_content.delegate_train_car_pickup_address,
jos_cck_store_item_content.delegate_flight_departure_airline,
jos_cck_store_item_content.delegate_departure_flight_number,
jos_cck_store_item_content.delegate_flight_departure_time,
jos_cck_store_item_content.delegate_flight_departure_airport_and_terminal,
jos_cck_store_item_content.delgates_departure_destination_airport,
jos_cck_store_item_content.delegate_departure_train_station,
jos_cck_store_item_content.delegate_train_departure_time,
jos_cck_store_item_content.departure_destination_train_station,
jos_cck_store_item_content.delegate_train_departure_pickup_address,
jos_cck_store_item_content.delegate_flight_departure_pickup_address,
jos_cck_store_item_content.delegate_bio AS delegate_bio_2,
jos_cck_store_item_content.introtext
FROM
jos_cck_store_form_delegate
INNER JOIN
jos_cck_store_item_content
ON
jos_cck_store_item_content.id = jos_cck_store_form_delegate.id
);