BenRussell
Programmer
I have 2 tables (for instance):
BOOKS
----------------------------------
book_id An ID number
author
title
BOOK_SIZE
----------------------------------
book_id The ID number from BOOKS
size i.e. Large, Small, etc.
The problem is that say I have 2 books in the BOOKS table. Book #1 has two sizes (Large and Small), but Book #2 has only one size (Large). So I only have 2 entries in BOOK_SIZE for Book #1, and do NOT have an entry in BOOK_SIZE for Book #2.
The problem occurs when I try the following SQL statement:
This of course returns 2 results: Both for Book #1 and NONE for Book #2.
How can I get around this so that it will still give me results for Book #1, but will just leave the 'book_sizes.size' field empty?
- Ben
BOOKS
----------------------------------
book_id An ID number
author
title
BOOK_SIZE
----------------------------------
book_id The ID number from BOOKS
size i.e. Large, Small, etc.
The problem is that say I have 2 books in the BOOKS table. Book #1 has two sizes (Large and Small), but Book #2 has only one size (Large). So I only have 2 entries in BOOK_SIZE for Book #1, and do NOT have an entry in BOOK_SIZE for Book #2.
The problem occurs when I try the following SQL statement:
Code:
SELECT books.book_id, books.author, books.title, book_size.size FROM books, book_size WHERE (books.book_id = book_size.book_id);
This of course returns 2 results: Both for Book #1 and NONE for Book #2.
How can I get around this so that it will still give me results for Book #1, but will just leave the 'book_sizes.size' field empty?
- Ben