Re: displaying repetitive results
| From: | Chris Lott | Date: | Sat, 13 Nov 2004 16:03:00 +0000 |
| Subject: | Re: displaying repetitive results | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-201924@lists.php.net to get a copy of this message | ||
On Sat, 13 Nov 2004 06:30:14 +0000, Curt Zirzow
<php-general@zirzow.dyndns.org> wrote:
> > You might normalize the data a bit.
>
> agreed!
>
> Curt
My data IS Normalized! The results you are seeing below are from
joining together the books, subjects, and books_subjects xref table,
as I explained below. But my point is that because the data is
normalized, I end up with a result set that shows one row per subject,
making aggregate display of the subjects (so they appear as one set
for the user) painful...
Thus the tables and query I posted:
The query and tables are simple:
select books.id, books.title, subjects.subject
from books, subjects, books_subjects
where books_subjects.bid = books.id
and books_subjects.sid = subjects.id
BOOKS
1. collected poems of keats
2. spy high
3. sci-fi spies
SUBJECTS:
1. poetry
2. suspense
3. sci-fi
4. horror
5. mystery
BOOKS_SUBJECTS
bid sid
1 1
2 2
3 2
3 3
c