If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Share data between two tables ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-23-09, 10:16
J#xx J#xx is offline
Registered User
 
Join Date: Feb 2009
Posts: 3
Share data between two tables ?

Hi, my second question !, is it possible and how would I share data between two existing tables. ie: Customers Table and Orders Table.

I need to have the contents of some fields from customers and copy them to replica fields in orders. I'm very, very new to this and basically been dropped in it at te deep end.

Assistance would be very grateful.

Cheers
J#xx
(Scott Perry)
MySQL V 5.1.30.
Reply With Quote
  #2 (permalink)  
Old 02-23-09, 11:07
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Quote:
Originally Posted by J#xx
is it possible and how would I share data between two existing tables. ie: Customers Table and Orders Table..
it is possible, with a trigger, but it is a very bad idea

instead, why not use a foreign key to relate the order to the customer, and use a join query when you want to show this "shared" data

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On