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:
Dell PowerEdge Servers
  #1  
Old August 7th, 2002, 11:48 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
get data out of 4 tables

Hi...
I got 4 tables
first table: columns r: username, userid, points, etc
2nd table: game_id, game_date, team1, team2, result1, result2
3rd table: user_id, game_id, bet_team1, bet_team2
4th table: team_id, team_name, team_pic

my prob is to get some data out of different tables onto one site!

I wanna have a site with a table on it listing all games with date, teamnames and results.
Do u have any solutions or tips for me?

Reply With Quote
  #2  
Old August 7th, 2002, 02:13 PM
EvilivE EvilivE is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Milwaukee, WI USA
Posts: 291 EvilivE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to EvilivE
RE: get data out of 4 tables

The query would be something like this, not exactly but hopefully you can see the logic:

select table1.username, table2.game_id, table3.user_id, table4.team_id from table1, table2, table3, table4

Like I said not exactly but that is how you select different fields from multiple tables. You can still apply WHERE clauses, etc to your queries also.

HTH

Reply With Quote
  #3  
Old August 8th, 2002, 09:36 AM
sager sager is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 45 sager User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: get data out of 4 tables

Maybe some day mysql will support views.
I wrote something similar to that in perl;)
Actually, probably more similar to clq/ogl

Reply With Quote
  #4  
Old August 8th, 2002, 02:02 PM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 23 sec
Reputation Power: 6
RE: get data out of 4 tables

I'd like nested selects before views.....

Reply With Quote
  #5  
Old August 8th, 2002, 06:20 PM
sager sager is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 45 sager User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: get data out of 4 tables

Views are cool, ever used them? They work just like a table. Nested selects tend to be a lot longer and have to think about them a little longer than a view. In either case, both work, so use what you have available

Reply With Quote
  #6  
Old August 9th, 2002, 12:46 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: get data out of 4 tables

Thank u for your help...
but I got it in a different way..

like this:
select s.*, m1.team_name as home, m2.team_name as guest from games s
left join teams m1 on m1.team_id=s.team1
left join teams m2 on m2.team_id=s.team2

now I got another problem...
how do i update my tables with data for different tables as one action?

Reply With Quote
  #7  
Old August 9th, 2002, 01:15 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: get data out of 4 tables

ok my table structure looks like this

table games
---------------------------------------------------------------------
|game_id | game_day | date | team1 | team2 | result1 | result2 |
|--------------------------------------------------------------------|
| 1 | 1 | 2002-08-10 | 1 | 11 | 2 | 3 |
| 2 | 1 | 2002-08-12 | 3 | 9 | 1 | 0 |
| 3 | 2 | 2002-08-15 | 8 | 2 | 4 | 2 |
|--------------------------------------------------------------------

table teams
---------------------
|team_id | team_name|
|--------------------
| 1 | FCK |
| 2 | BVB |
| 3 | HSV |
|--------------------

table tip

-----------------------------------------------------------
|tip_id | user_id |game_id| tip_team1 | tip_team2 | points |
|-----------------------------------------------------------
| 1 | 1 | 2 | 1 | 1 | 2 |
| 2 | 5 | 3 | 3 | 4 | 1 |
| 3 | 8 | 5 | 8 | 2 | 4 |
|-----------------------------------------------------------

table user

---------------------
|user_id | user_name |
|--------------------
| 1 | Joe |
| 2 | John |
| 3 | Alex |
|--------------------

Now I want to get the data out of those tables to see the results of "Game_day 1" with infos: date, team names, the results and a changing site for the admin thus he can make entries on the results.

for the users I got a login system. If they log in I need a query thus they can see the infos: date, teamnames, gameday, and they have to put in the result-tips.

I would be really happy if u would help me!!

THX

Reply With Quote
  #8  
Old August 10th, 2002, 05:00 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: get data out of 4 tables

nobody there to help me?

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > get data out of 4 tables


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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





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