I have a MySQL database that my php file accesses.
I have successfully created two tables with the following:
CREATE TABLE data01
SELECT orders.order_id, user_email, last_name
from auth_user_md5,user_info, orders
where user_info.user_id=auth_user_md5.user_id
AND orders.user_id=user_info.user_id
AND user_info.address_type='Purchaser'
CREATE TABLE data02
SELECT order_id, order_subtotal, order_status, company, title, first_name, middle_name, last_name, phone_1, phone_2, address_1, address_2, city, state, zip, country
FROM orders, user_info
WHERE user_info.user_info_id=orders.user_info_id
I would like to create a table with information from both tables.
Challenge: The first table has the field last_name which is the last name of the purchaser. The second table also has the field last name and it is the last name of the receiver. Sometimes the purchaser and receiver are one and the same..other times different. (same with user_email in table one).
Should I make one table with one query (is it possible) or merge the tables afterward?
If so, please assist with the merging.
Thanks.