On 14 Jan 2003, at 15:28, Peter van der Kamp wrote:

> What should be the result when I issue the following 
> query:
> select naam_bron from bron, topic where
> (bron.media="Book")
> or (topic.naam_bron = bron.naam_bron and
> topic.topic_code = "5.1");
> 
> Before posting my results I'll wait for your answers 
> so I can see if there's a bug in 3.23.32 or that I 
> need to return to highschool :)

I won't say you need to go back to high school, but maybe you need to 
review how SQL works.  You have no criterion for joining your two 
tables, so your result set will contain every row from bron that has 
media = 'Book' combined with absolutely every row from topic.  In 
addition, you'll have every row from topic that has a topic_code of 
'5.1' combined with whatever rows of bron have a matching naam_bron.

It's hard to know, but I suspect you want something like

   SELECT naam_bron FROM bron, topic
   WHERE topic.naam_bron = bron.naam_bron
     AND ( bron.media = 'Book' OR topic.topic_code = '5.1' );

or, written another way,

   SELECT naam_bron
   FROM bron INNER JOIN topic USING (naam_bron)
   WHERE bron.media = 'Book' OR topic.topic_code = '5.1';

-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Tobacco Documents Online
http://tobaccodocuments.org
Phone 202-667-6653

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to