Results 1 to 25 of 36
Thread: SELECTing from 3 tables at once?
May 19, 2004, 14:24 #1
- Join Date
- Mar 2004
- 0 Post(s)
- 0 Thread(s)
SELECTing from 3 tables at once?
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
GROUP BY books.isbn
SELECT books.isbn, title, authors
FROM books, for_sale
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. . .