Chris wrote:
snip
select *
from customers c, issues i, customer_issues ci
where c.customerid=ci.customerid
AND ci.issueid=i.issueid;
Chris wrote:
snip
That query should be the same as this one:
select *
from customers c
inner join customer_issues ci on (c.customerid=ci.customerid)
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 right
EXPLAIN is documented in the manual
http://dev.mysql.com/doc/refman/4.1/en/explain.html.
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:
Michael Stassen wrote:
Chris wrote:
snip
select *
from customers c, issues i, customer_issues ci
where c.customerid=ci.customerid
AND ci.issueid=i.issueid;
Chris wrote:
snip
That query should be the same as this one:
select *
from customers c
inner join customer_issues ci on
Chris wrote:
snip
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
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, customer_issues ci
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.id)
WHERE
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.customers.id = mcsdata.issues.id
[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
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
[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
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 will
: 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 where, you'd end up with lots of rows but with the
where
13 matches
Mail list logo