List:MySQL on Win32« Previous MessageNext Message »
From:Michael Widenius Date:October 5 1999 7:44pm
Subject:Win32 version bug ? Select returns too many rows
View as plain text  
>>>>> "Alain" == Alain Fontaine <alain@stripped> 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.costprice,
Alain> products.manufacturer,products.promotion,products.webpage,products.profit_pe
Alain> rcent,
Alain> products.currency,products.top_pick,manufacturer.num,,
Alain> manufacturer.webpage, currencies.ISO, currencies.rate,
Alain> products.category_2,sub_categories.num,
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 LIKE '%pent%'
Alain> OR LIKE '%int%'
Alain> ----

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


You don't have any braces around: 

'OR 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 ( LIKE '%pent%'
     OR LIKE '%int%')


Win32 version bug ? Select returns too many rowsAlain Fontaine1 Oct
  • Re: Win32 version bug ? Select returns too many rows(Hood Gardner)1 Oct
  • Win32 version bug ? Select returns too many rowsMichael Widenius5 Oct