I have a db full of articles that have a category field.
Is there anyway to select and display just the different categories?
I have a db full of articles that have a category field.
Is there anyway to select and display just the different categories?
Sure...
select distinct category from articles;
No, that's easy. What I am trying to do is make a list of the categories in the database without already knowing what is in it so oI can make a menu with links.
asuming your field is named catagory your SELECT command would look something like this:
SELECT DISTINCT catagory FROM article_db ORDER BY catagory;
This would go through the catagory field, select all the Unique entries so each catagory name only appears once, and displays them in alphabitical order.
Yea I noticed that other user up there was right too. Thanks! I figured it out!!
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.