Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old February 6th, 2004, 07:57 PM
optiondelete optiondelete is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 75 optiondelete User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to optiondelete
selection matching

I am building a simple classifieds script. I have two tables, one for the categories of the classifieds, and another for the classifieds themselves. I want only the categories to display on the first page, and only categories who have someone signed up under them.

for example, if I have parts, ovens, tools, misc as my categories, and there are only people signed up under tools and oven, only tools and ovens should show up.

I am not so hot yet at queries, but this is what I got so far:

SELECT category.category, classifieds.categoryid FROM category, classifieds WHERE classifieds.categoryid = category.categoryid

this brings them all up, could I get some help with this?

Reply With Quote
  #2  
Old February 6th, 2004, 08:06 PM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: selection matching

sounds like all of the numbers for these two fields are auto number. basically what you have told it to do is an informal JOIN, saying, join the fields of these two tables where this id equals this id. Of course, they both have the same number that matches at some point, hence you get everything form the tables for these two columns.

Reply With Quote
  #3  
Old February 6th, 2004, 08:10 PM
optiondelete optiondelete is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 75 optiondelete User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to optiondelete
RE: selection matching

ok, but I also only want it to show up once. so if there are members under tools, no matter how many members, I just want "tools" to show up once.

Reply With Quote
  #4  
Old February 6th, 2004, 08:13 PM
optiondelete optiondelete is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 75 optiondelete User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to optiondelete
RE: selection matching

And I do this by adding the 'distinct' statement to my select don't I?

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > selection matching


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT