Master/Detail queries

"Stefan Elwesthal" <[email protected]>
Newsgroups gmane.comp.gnu.enterprise.general
Message-ID <[email protected]>
Hello all!

Spent my night trying to work through all this new knowledge that I received yesterday playing with GNUe.

One thing bothers me, but this might be my lack of knowledge in the database field, I aplogize if that's the case.
(I've only gotten to page 62 in the "MySQL Bible" yet)

If I create two tables like this:

CREATE TABLE customer 

(

    customer_id INT NOT NULL,

    name        VARCHAR(30),

    PRIMARY KEY (customer_id)

) TYPE = INNODB;



CREATE TABLE customer_sales 

(

    transaction_id INT NOT NULL,

    amount 	   INT,

    customer_id    INT NOT NULL,

    PRIMARY KEY(transaction_id),

    INDEX (customer_id),

    FOREIGN KEY (customer_id) REFERENCES customer (customer_id) 

) TYPE = INNODB;

And link them together like this:

  <datasource name="dtsCUSTOMER0" connection="innodbtest" requery="True"

              table="customer"/>

  <datasource name="dtsCUSTOMER_SALES1" connection="innodbtest"

              detaillink="customer_id" master="dtsCUSTOMER0" masterlink="customer_id" requery="True"

              table="customer_sales"/>

I can only perform queries on customer_id's, otherwise I get such a HUGE Error message that I could spend half a day reading through it. Now, in an Ordertable one would like to select the Ordernumber, and then bring up the customer_id (which would be the reference to link together the tables).

It's too early, maybe I'm jabbering, and the more I think about it, this seem to be a question about database design, I suppose a GNUe-form could have several master/detail relations?

Regards
Stefan - the one who really would prefer to be at home not in his office today..
-- 
______________________________________________
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.