Jump to content

multiple table query help


Twitch

Recommended Posts

Just when I start celebrating the fact that I'm getting the hang of multiple table queries, I stall on one for a several hours again...haha

 

I am trying to determine if a venue has open tables on a certain date or not.  Each venue can have several tables. 

 

The query below gives me an error: #1241 - Operand should contain 1 column(s)

SELECT *
FROM
  venues
INNER JOIN venue_tables ON (venues.venueID = venue_tables.venueID)
  INNER JOIN cities ON (venues.cityID = cities.cityID)
  INNER JOIN states ON (venues.stateID = states.stateID)
  INNER JOIN price ON (venues.priceID = price.priceID)
WHERE venues.cityID='74' AND venue_tables.tableID NOT IN (SELECT * FROM reservations WHERE reservationDate = '2010-11-26') GROUP BY venue_tables.tableID ORDER BY venueName ASC

 

I simply want to return a list of venues that have an open table on a certain date.  I've hard coded the query for testing purposes.

 

Any help would be greatly appreciated.  I'm sure I'm missing something simple.

 

Thanks in advance,

Twitch

 

EDIT NOTE: I had to edit the venue_tables JOIN to be ON venueID instead of tableID  still get the error though

Link to comment
https://forums.phpfreaks.com/topic/219299-multiple-table-query-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.