3 messages in com.mysql.lists.win32Win32 version bug ? Select returns to...
FromSent OnAttachments
Alain Fontaine01 Oct 1999 03:33 
Hood Gardner01 Oct 1999 06:38 
Michael Widenius05 Oct 1999 12:44 
Subject:Win32 version bug ? Select returns too many rows
From:Michael Widenius (mon@monty.pp.sci.fi)
Date:10/05/1999 12:44:11 PM
List:com.mysql.lists.win32

"Alain" == Alain Fontaine <ala@valain.com> writes:

Alain> Hello, Alain> I am running the latest Win32 shareware version (not yet registered) on Alain> Windows98.

Alain> I have a database containing about 7 tables. The main table is called Alain> "products", containing computer equipment.

Alain> This table contains 9 records.

Alain> When I do the following SELECT statement:

Alain> ---- Alain> select products.prod_id,products.name,products.costprice, Alain>
products.manufacturer,products.promotion,products.webpage,products.profit_pe Alain> rcent, Alain> products.currency,products.top_pick,manufacturer.num,manufacturer.name, Alain> manufacturer.webpage, currencies.ISO, currencies.rate, Alain> products.category_2,sub_categories.num, Alain> sub_categories.name Alain> from products, manufacturer, currencies, sub_categories Alain> where products.manufacturer=manufacturer.num Alain> and products.currency=currencies.ISO Alain> and products.category_2 = sub_categories.num Alain> and products.name LIKE '%pent%' Alain> OR manufacturer.name LIKE '%int%' Alain> ----

Alain> the query return 2295 rows (obviously, with 9 records in my products
table, Alain> this seems strange).

Hi!

You don't have any braces around:

'OR manufacturer.name LIKE '%int%''

This means that you say:

'for any combination of the rows of all preceding tables', give me all rows that has 'int' somewhere in name.

I assume you want to do something like

... WHERE products.manufacturer=manufacturer.num and products.currency=currencies.ISO and products.category_2 = sub_categories.num and (products.name LIKE '%pent%' OR manufacturer.name LIKE '%int%')

Regards, Monty