I have a php script with a query that brings me back all books from the books table whos book date meets a criteria (date matches and books.uid <>1). The query worked fine, however when i added the available.AvailableDates it throws an error.
I want to bring the book date back too but as the table that holds the book date is in the subquery it cant find it. Below is the query with the available table and field added and the error:
// get all books from books table
$result = mysql_query("SELECT books.uid, book.name, book.description, available.AvailableDates
WHERE EXISTS (SELECT 0 FROM available A1, available A2
WHERE A1.uid =1 AND A2.uid = books.uid
AND A1.AvailableDates = A2.AvailableDates
AND books.uid <>1)") or die(mysql_error());
Unknown column 'available.AvailableDates' in 'field list'
How can i pull the availabledates column into the select statement?