Hello Jonas,

Looking to the second query I think you're having a "cartesian product". For each row 
in one table you get all the rows from the other table. (And that's usually not the 
intended result.) This is because there is no join between the tables.

I think that adding a where clause to your query that joins the "b" table with the "d" 
table should solve your problem.

Hope this helps you further.

Best Regards,

Jan.



-----Original Message-----
From: Jonas Lindén [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 24, 2004 11:57 AM
To: [EMAIL PROTECTED]
Subject: Select statement returning to many answers

Hello, I am running MySQL5.0.0 on my OpenBSD system. When I excute this
query I get 153 hits.

    SELECT b.batch_id, b.date, b.creator, b.comments FROM cd_batch as b;

But when I add this table to the where clause i get 5831 hits

    SELECT b.batch_id, b.date, b.creator, b.comments FROM cd_batch as b,
cd_donor as d;

Why does this happend? I thought that these two queries would return the
exact same amout of rows. Is there something I have forgotten or is the
debug release of 5.x.x errornous?

Regards
/Jonas


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to