I have a problem with the following MySQL query:
SELECT * FROM TPDSessions WHERE TPDS_Morning = 0 AND TPDD_Id = 1 AND TPDS_Chair1_idPerson = 16785 OR TPDS_Chair2_idPerson = 16785
The row returned has TPDS_Morning with a value of 1 in it, and I don't get why. This is the table structure:
CREATE TABLE `TPDSessions` (
`TPDS_Id` int(11) NOT NULL auto_increment,
`TPDR_Id` int(32) NOT NULL,
`TPDD_Id` int(32) NOT NULL,
`TPDS_Morning` tinyint(1) NOT NULL,
`TPDS_Name` varchar(200) NOT NULL,
`TPDS_Chair1_idPerson` int(11) NOT NULL,
`TPDS_Chair2_idPerson` int(11) NOT NULL,
PRIMARY KEY (`TPDS_Id`),
KEY `chair1_idPerson` (`TPDS_Chair1_idPerson`,`TPDS_Chair2_idPerson`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
If anyone can explain how to adjust my query to not return that result...