Hi everyone I’m having a problem.
I have two SQL queries that are both returning different results:
SELECT name, capacity, $price, licensed, cost
FROM venue, catering WHERE venue.venue_id = catering.venue_id
AND grade=$grade
AND capacity >= $minCapacity
AND capacity <= $maxCapacity
AND venue.venue_id
NOT IN (SELECT venue_id FROM venue_booking WHERE date_booked = $us_date)
as well as
SELECT venue.venue_id,name,capacity,licensed,$price,cost
FROM venue
JOIN catering ON venue.venue_id = catering.venue_id
WHERE capacity BETWEEN '$minCapacity' AND '$maxCapacity'
AND venue.venue_id NOT IN
(SELECT venue_id
FROM venue_booking
WHERE date_booked = '$us_date')
AND catering.grade = '$grade' ORDER BY venue.capacity
What is the difference here?
what I am feeling .. main difference is –
in first query you are checking capacity with condition –
which will apply as number ..
but in second query this condition is in range of two string values..