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 August 7th, 2002, 12:48 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: 25
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, 03: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: 3
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, 10: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: 3
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, 03:02 PM
Matt Matt is offline
Contributing User
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 12 m 16 sec
Reputation Power: 7
RE: get data out of 4 tables

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

Reply With Quote
  #5  
Old August 8th, 2002, 07: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: 3
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, 01: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: 25
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, 02: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: 25
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, 06: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: 25
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!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

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




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek