So my basic query is

SELECT books.isbn as ISBN, books.title as Title, books.authors as Authors, books.edition as Edition
FROM books WHERE 1=1
AND books.isbn = $search_isbn
AND books.title = $search_title
AND books.authors = $search_authors
AND books.edition = $search_edition

If you leave any field empty it is ignored so you can get a list of books by the same author for example.

Simple enough. But I need to get some extra info to append to the table that is generated. I have 2 another querys that work fine alone:

SELECT COUNT(factual.id) as NoFactual, books.isbn as ISBN, books.title as Title, books.authors as Authors, books.edition
FROM books, factual
WHERE books.isbn=$isbn
AND books.isbn=factual.isbn
GROUP BY books.isbn

and

SELECT books.isbn, title, authors
FROM books, for_sale
WHERE books.isbn=for_sale.isbn
AND books.category1 = '$for_sale_category'
ORDER BY title DESC

What I really need is to combine them all so that I get a table with the headings: isbn, title, authors, edition, NoFactual(number of factual entries), and for_sale(or even number for sale).

It is too much for my brain. . .