Unanswered: Using results from one query in another
First of all hello everyone, I'm new to the forum and have very little experience with databases.
I have read only access to a MySQL database with 2 tables:
"venue" with fields: venue_id, name, capacity, weekend_price, weekday_price, licensed
"venue_booking" with fields: venue_id, date_booked
I have a html page with a form with 2 inputs: date, and party size.
Then i have a php page which takes these two values as input, and tries to output a table with: name, weekend_price, weekday_price for the venues that fit the criteria.
I'm a bit lost as how to do this..
I've got "SELECT venue_id FROM $venue_booking WHERE date_booked = '$date'", which gives me the venue id's for the venues which are NOT available.
I then need to search for the names and prices of all the venues which do NOT have any of those id's in the other table, and output the fields.
Any help would be greatly appreciated, and please bear in mind that my experience is limited.
ON venue_booking.venue_id = venue.venue_id
AND venue_booking.date_booked = '$date'
WHERE venue_booking.venue_id IS NULL
AND venue.capacity >= $partysize
Wow I'm really bad at this.. Here's what I've got:
catering.venue_id = venue.venue_id
catering.grade = '$grade'
LEFT OUTER JOIN
venue_booking.venue_id = catering.venue_id
venue_booking.date_booked = '$date'
venue_booking.venue_id IS NULL
venue.capacity >= $partySize
But it doesn't work.. (probably because I'm not familiar with the syntax)