RE: 1 to many relationship

2006-08-17 Thread Peter Lauri
14 AM To: mysql@lists.mysql.com Cc: Chris; Peter Lauri Subject: Re: 1 to many relationship Peter Lauri wrote: > Is there not a better way to do that? What will happen there is that a large > result set will be created because when you just do "select * from > customers c, issues i,

Re: 1 to many relationship

2006-08-17 Thread Michael Stassen
Chris wrote: > Hmm. Must be a recent change, I've had problems with that in the past. > > Thanks for the pointers. You're welcome. I'm not sure which part you think is a recent change. Certainly, mysql 5 with its demotion of the precedence of the implicit join is recent. Perhaps it depends o

Re: 1 to many relationship

2006-08-17 Thread Chris
Michael Stassen wrote: Chris wrote: > select * > from customers c, issues i, customer_issues ci > where c.customerid=ci.customerid > AND ci.issueid=i.issueid; Chris wrote: > That query should be the same as this one: > select * > from customers c > inner join customer_issues ci on (c.

Re: 1 to many relationship

2006-08-17 Thread Chris
EXPLAIN is documented in the manual . So it is, but it doesn't show me the decisions it makes. It shows me whether it will use an index or not, it won't show me how it puts the whole thing together. Compare to the postgres one: http://w

Re: 1 to many relationship

2006-08-17 Thread Michael Stassen
Peter Lauri wrote: > Is there not a better way to do that? What will happen there is that a large > result set will be created because when you just do "select * from > customers c, issues i, customer_issues ci" it will be like the inner product > from all these tables, and then just choosing the

Re: 1 to many relationship

2006-08-17 Thread Michael Stassen
Chris wrote: > select * > from customers c, issues i, customer_issues ci > where c.customerid=ci.customerid > AND ci.issueid=i.issueid; Chris wrote: > That query should be the same as this one: > select * > from customers c > inner join customer_issues ci on (c.customerid=ci.customerid) > inne

RE: 1 to many relationship

2006-08-15 Thread Peter Lauri
AIL PROTECTED] Sent: Wednesday, August 16, 2006 11:00 AM To: Peter Lauri Cc: mysql@lists.mysql.com Subject: Re: 1 to many relationship Peter Lauri wrote: > [snip "Chris"] > The 'where' clause cuts that down to only matching records between the > tables. Without the w

Re: 1 to many relationship

2006-08-15 Thread Chris
Peter Lauri wrote: [snip "Chris"] The 'where' clause cuts that down to only matching records between the tables. Without the where, you'd end up with lots of rows but with the where it will be fine. [/snip] Yes, it cuts it down to that number of records in the end, so the final result set wil

RE: 1 to many relationship

2006-08-15 Thread Peter Lauri
[snip "Chris"] The 'where' clause cuts that down to only matching records between the tables. Without the where, you'd end up with lots of rows but with the where it will be fine. [/snip] Yes, it cuts it down to that number of records in the end, so the final result set will just be a few rows t

Re: 1 to many relationship

2006-08-15 Thread Chris
Peter Lauri wrote: [snip "Chris"] If you want multiple customers to be associated with each issue you need 3 tables: create table customers (customerid int auto_increment primary key, customername varchar(255)); create table issues (issueid int auto_increment primary key, issuetitle varch

RE: 1 to many relationship

2006-08-15 Thread Peter Lauri
[snip "Chris"] If you want multiple customers to be associated with each issue you need 3 tables: create table customers (customerid int auto_increment primary key, customername varchar(255)); create table issues (issueid int auto_increment primary key, issuetitle varchar(255)); create table

Re: 1 to many relationship

2006-08-15 Thread Chris
Brian E Boothe wrote: how do i do 1 to many relationship?? i have this SQL syntax " i may need to add many issues per customer" so this is what i have Please help SELECT * FROM mcsdata.customers INNER JOIN mcsdata.issues ON (mcsdata.cu

1 to many relationship

2006-08-15 Thread Brian E Boothe
how do i do 1 to many relationship?? i have this SQL syntax " i may need to add many issues per customer" so this is what i have Please help SELECT * FROM mcsdata.customers INNER JOIN mcsdata.issues ON (mcsdata.customers.id = mcsdata.issues