Forum Moderators: open
Anyways, I have two tables and am trying to pull data from them both.
news
id ¦ 1 auto +
cat_id ¦ 0 or 1
title ¦ title
news_categories
id ¦ 1 or 2
catname ¦ test cat 1 or test cat 2
This is for a news publishing application. I want to print off all news stories in the database and also be able to display their category. Would I use a join or union for this, and if so what would it look like?
Also, should I change news_categories id to cat_id? If so, that would be primary key correct? And cat_id of news would be just key as id is primary?
Thanks for any help you can offer. If needed, I can provide the snippet of script that has the query and prints the data off in alternating row colors.