Jump to content

Merge two databases


andy666

Recommended Posts

I have two databases one has products in it one has product descriptions in it both databases use the order number as the index is it possible to merge the two so that the product description is in the correct field of the product in the product database here is an example of the two databases

 

product database

 


-- phpMyAdmin SQL Dump
-- version 2.9.2
-- http://www.phpmyadmin.net
-- 
-- Host: localhost
-- Generation Time: Apr 10, 2007 at 03:09 PM
-- Server version: 5.0.27
-- PHP Version: 5.2.1
-- 
-- Database: `store`
-- 

-- --------------------------------------------------------

-- 
-- Table structure for table `products`
-- 

CREATE TABLE `products` (
  `Product_Category` varchar(255) default NULL,
  `Order_Number` varchar(255) default NULL,
  `Product_Name` varchar(255) default NULL,
  `Model_Number` varchar(255) default NULL,
  `Product_Manufacturer` varchar(255) default NULL,
  `Product_Price` double default NULL,
  `Current_Stock` int(11) default NULL,
  `Product_Descr` varchar(255) default NULL,
  KEY `Order_Number` (`Order_Number`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- 
-- Dumping data for table `products`
-- 

INSERT INTO `products` (`Product_Category`, `Order_Number`, `Product_Name`, `Model_Number`, `Product_Manufacturer`, `Product_Price`, `Current_Stock`, `Product_Descr`) VALUES 
('PC Components', 'BRDAB034', 'Abit IL9 Pro Socket 775 ATX', 'IL9 PRO', 'ABIT', 59, 11, NULL),
('PC Components', 'BRDAB032', 'Abit NF-M2-S SKT AM2 MATX', 'NF-M2-S', 'ABIT', 49, 46, NULL),
('PC Components', 'BRDAB031', 'Abit IP 95 SKT 775 MATX', 'IP 95', 'ABIT', 45, 61, NULL);

 

 

product description database

 


-- phpMyAdmin SQL Dump
-- version 2.9.2
-- http://www.phpmyadmin.net
-- 
-- Host: localhost
-- Generation Time: Apr 10, 2007 at 03:10 PM
-- Server version: 5.0.27
-- PHP Version: 5.2.1
-- 
-- Database: `desc`
-- 

-- --------------------------------------------------------

-- 
-- Table structure for table `desc`
-- 

CREATE TABLE `desc` (
  `Order_Number` varchar(255) default NULL,
  `Product_Descr` varchar(255) default NULL,
  KEY `Order_Number` (`Order_Number`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- 
-- Dumping data for table `desc`
-- 

INSERT INTO `desc` (`Order_Number`, `Product_Descr`) VALUES 
('BRDAB034', 'Description         : ATX socket 775 Motherboard                                                                                                            ,,,,,,,,,,,,,,'),
('BRDAB034', 'Dual Core CPU support + Conroe                                                                                                        ,,,,,,,,,,,,,,');

 

Link to comment
Share on other sites

Your logic looks wrong to me...

 

Why don't you have a product table where you have the item code, description...and then have an order table where you have each record pointed to a product id.

 

I think you will find that a lot easier to manage.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.