View Full Version : Operand should contain 1 column(s)..???

03-18-2007, 10:34 PM
i have the following twp tables in my database

create table buses(id INT (3) PRIMARY KEY,
date DATE,
time TIME,
departure VARCHAR(3),
destination VARCHAR(3))

create table seats(id INT(3),
seat INT(2),
status ENUM ("booked","empty") NOT NULL,
PRIMARY KEY (id,seat),
CONSTRAINT seats_id_fk FOREIGN KEY (id) REFERENCES buses(id))

i want to retrieve the seats.seat where id field of both tables match and other variables as well.im starting by selecting id from the first table the query im using is:
select id from buses
where (buses.date='$date',buses.time='$time',

this gives the error

Operand should contain 1 column(s)

03-18-2007, 11:16 PM
problem solved.i had to use and instead of the commas.
silly mistake:o

03-19-2007, 02:33 AM
small item to note, you don't show if your tables are INNODB types, if they are not your foreign key constraint will not be enforced.