Hi,
I have the following table:
CREATE TABLE Car (
Car_Id int(6) NOT NULL default '0',
Car_Maker varchar(18) default NULL,
Car_Year int(4) default NULL,
PRIMARY KEY (Car_Id)
) TYPE=MyISAM;
I have a search page which queries the db and
should produce a list of cars with respective properties.
I have a problem with the Car_Year.
From some reason it pulls years which are not in
the query.
It is likely that my query is not optimized or not setup correctly
and for that I need you help.
It's only the YEARS that produce the problem.
In a narrative form: I want the cars (could be either cadillac, buick or dodge all of them or part of them) that were made
between 1950 and 1961 inclusive only.
I get all the cars that I wanted.. but also I get a car that was created in 1965! So obviously something is not working properly.
I use the following query:
SELECT Car.Car_Id, Car.Car_Maker, Car.Car_Year
FROM Car
WHERE Car.Car_Maker = 'cadillac' or Car.Car_Maker = 'buick' or Car.Car_Maker = 'dodge' AND Car.Car_Year >= 1950 AND Car.Car_Year <= 1961 AND Car.Car_Id>0
Your help is greatly appreciated!
-Alon.