User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 374,023 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,766 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 1475 | Replies: 4
Reply
Join Date: Oct 2006
Posts: 7
Reputation: nickclarson is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
nickclarson nickclarson is offline Offline
Newbie Poster

A mysql select question.

  #1  
Mar 4th, 2007
I have a db full of articles that have a category field.

Is there anyway to select and display just the different categories?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2006
Posts: 91
Reputation: ses5909 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
ses5909 ses5909 is offline Offline
Junior Poster

Re: A mysql select question.

  #2  
Mar 4th, 2007
Sure...

select distinct category from articles;
Reply With Quote  
Join Date: Oct 2006
Posts: 7
Reputation: nickclarson is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
nickclarson nickclarson is offline Offline
Newbie Poster

Re: A mysql select question.

  #3  
Mar 4th, 2007
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.
Reply With Quote  
Join Date: Sep 2006
Location: Canada
Posts: 55
Reputation: GliderPilot is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
GliderPilot's Avatar
GliderPilot GliderPilot is offline Offline
Junior Poster in Training

Re: A mysql select question.

  #4  
Mar 5th, 2007
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.
Reply With Quote  
Join Date: Oct 2006
Posts: 7
Reputation: nickclarson is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
nickclarson nickclarson is offline Offline
Newbie Poster

Re: A mysql select question.

  #5  
Mar 5th, 2007
Yea I noticed that other user up there was right too. Thanks! I figured it out!!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MySQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 11:23 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC