4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 I challenge you....
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Tue Apr 16, 2002 3:03 pm (15 years, 6 months ago) Reply with QuoteBack to Top

....to save me from MySQL hell.

On my Fancy Rats site we have a list of name suggestions for people to call their rats which have been contributed by other users of the site. I am making a new database driven version and I want to be able to show the Top 5 name contributors. Below are the relevant parts of the tables I have created and also the result the query should give (I know there aren't 5 but the principal is the same).

Any chance anyone could help me with the MySQL query? I always manage to really confuse myself when more than one table is involved. Let me know if you need any more info.

Code:
ratnames_names
+---------+-----------+-------------+
| name_id | name      | contributor |
+---------+-----------+-------------+
|    1    | Ratty     |      2      |
|    2    | Splinter  |      1      |
|    3    | Tails     |      2      |
|    4    | Scruffy   |      2      |
|    5    | Rabies    |      3      |
|    6    | Hairy     |      1      |
+---------+-----------+-------------+

ratnames_contributors
+----------------+------------------+
| contributor_id | contributor_name |
+----------------+------------------+
|       1        | Tom              |
|       2        | Dick             |
|       3        | Harry            |
+----------------+------------------+


Quote:
Result
A. Dick (3 names)
B. Tom (2 names)
C. Harry (1 names)
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Wed Apr 17, 2002 7:30 am (15 years, 6 months ago) Reply with QuoteBack to Top

Don't worry, I got help from else where. Problem is solved. Wink
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.054571 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme