Database Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsDatabasesDatabase Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 16th, 2010, 02:05 AM
dekrelo dekrelo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2010
Posts: 2 dekrelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 42 sec
Reputation Power: 0
Modeling and query help

Hi all,

I need help for modeling and query from database. I'm makeing sport startistic site and have problem with head-to-head section. I have 2 tables: 1. players (id, player, country, dob,....) and 2. matches (id, player1, score1, player2, score2, tournament, season......). I have two dynamic list menus with players. User choose two player and click some button. The result have to be matches between selected player. I work with mysql and dreamweave, I try to pass through URL and pass through Form Variable but no result. Now I try to make many-to-many relation between tables, but need help with ideas for realisation, please!

Reply With Quote
  #2  
Old February 24th, 2010, 07:45 AM
dekrelo dekrelo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2010
Posts: 2 dekrelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 42 sec
Reputation Power: 0
My detailed question?

I have 3 tables:
1. players (player_id, player, country, dob.....)
2. matches (matches_id, player1, score1, player2, score2, tournament, season....)
3. playerMatches (player_id, matches_id)

I have many-to-many relationship. I need to query all matches between whoever two selected from user players.
That is my question? Thanks!

Reply With Quote
  #3  
Old August 13th, 2011, 04:23 PM
dg001 dg001 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 1 dg001 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 48 sec
Reputation Power: 0
Quote:
Originally Posted by dekrelo
My detailed question?

I have 3 tables:
1. players (player_id, player, country, dob.....)
2. matches (matches_id, player1, score1, player2, score2, tournament, season....)
3. playerMatches (player_id, matches_id)

I have many-to-many relationship. I need to query all matches between whoever two selected from user players.
That is my question? Thanks!



You will need to use a self join on playerMatches

the sql will look like

select a.match_id
from playerMatches a , playerMatches b
where a.player_id <> b.player_id
and a.match_id = b.match_id

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesDatabase Development > Modeling query help


Developer Shed Advertisers and Affiliates


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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap