Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Operand should contain 1 column(s)..???

    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',
    buses.destination='$destination',buses.departure='$departure')

    this gives the error

    Operand should contain 1 column(s)
    ???

  • #2
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    problem solved.i had to use and instead of the commas.
    silly mistake

  • #3
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •