GJSNeptune
[H]F Junkie
- Joined
- Mar 31, 2004
- Messages
- 12,372
On my site I want to have a box showing my most recently uploaded content. It'll be from multiple categories, like blog, poetry, fiction, nonfiction, and possibly others. It's a basic list of the titles of that content, and next to each title is the category each one is under.
At first I did this using one table for all my writing to go into. That way it'd be easy; just sort the whole table by date and I'd get my most recent activity. I've now run into a problem, but perhaps it's just my table structure, which is basically:
id
type
date
title
text
This works fine, except pieces aren't unique to their category. In other words, my second blog entry might have the id of 7, instead of a unique blog id of 2. I thought about adding fields to the table, such as blog_id, poetry_id, fiction_id, etc., but I'm thinking there's an easier way.
Is there a way to select from multiple tables my most recent activity? I'd have to somehow analyze each table (four or more) and determine the most recent (let's say 7) pieces inserted into the database. Is this possible? Would it be taxing on the database and therefore quite slow or inefficient?
At first I did this using one table for all my writing to go into. That way it'd be easy; just sort the whole table by date and I'd get my most recent activity. I've now run into a problem, but perhaps it's just my table structure, which is basically:
id
type
date
title
text
This works fine, except pieces aren't unique to their category. In other words, my second blog entry might have the id of 7, instead of a unique blog id of 2. I thought about adding fields to the table, such as blog_id, poetry_id, fiction_id, etc., but I'm thinking there's an easier way.
Is there a way to select from multiple tables my most recent activity? I'd have to somehow analyze each table (four or more) and determine the most recent (let's say 7) pieces inserted into the database. Is this possible? Would it be taxing on the database and therefore quite slow or inefficient?