Jene,
Well you took on a good itermediate to maybe advanced project here... <grin>
Maybe someone can give you some simpler ideas, pretty simple to me though...
Because your last category could have many selections, this is called a many to one relationship in the database world.
Because I think you should use a map table, this gives you a many to many relationship in the database. Meaning that you can assign more than one article to more than one selection in two different tables... Takes a twisted mind to understand sometimes...
With what you have described you can hard code the first two field into your article id table, but your last field you'll have to map it out...
But since I'm against hard coding into one table lets go through this...
In your article table you should have at least 2 fields
article_id (primary key) and article column
art_id | article
Now let's build a look up table...
The lookup table is only the name and describing of each of the choices...
You can use this over and over, it does not match directly to the article table...
So it would look like this
lu_id | lu_lbl note: lbl = label
Now your going to build a mapping table
The mapping table matches the label to the article
map_id | art_id | lu_id
So in your select it would look something like this:
SELECT art.art_id, art.article
FROM article art, lookup lu, map
WHERE
(art.art_id = map.art_id AND
lu.lu_id = map.lu_id) AND
(lu.lu_lbl = 'choice1' AND
lu.lu_lbl = 'choice2' AND
lu.lu_lbl = 'choice3')
This is join between 3 tables Article, Lookup and Map.
You might have to play with the above to give you the results you need...
But here's what is happening, only when 3 of the choices match will rows be returned... If you want any result that matches any of the choices, then use OR instead of AND in between the choices... Remember to use () to keep the selection of the join seperate from the choices...
There are a whole lot of ways to do this...
you could also create a table for each type of choice
you could also hard code this into 3 fields in the article table and forget the join....
However let's say down the road you want to populate some drop downs from the lookup table... Then you'll need to add another field in the mapping table called grp_id and yep you guessed it a groups table...
and you'll join this just like you did the other tables....
Its coders preference from here...
But either way you need to put some thought into what is easier for you to maintain and what is scalable...
Hope that helps....