The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Special Forums > Web Programming, Web 2.0 and Mashups
.
google unix.com



Web Programming, Web 2.0 and Mashups Discuss Web Programming and Web Server Administration, including LAMP, Apache, MySQL, Flash, HTML, SEO, Mashups and other Web APIs and topics.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Developing MySQL Database Applications With PHP Part 1: Using the MySQL Improved Exte iBot Solaris BigAdmin RSS 0 06-12-2009 06:00 PM
sql,multiple join,outer join issue robbiezr High Level Programming 0 06-05-2009 11:26 PM
MySQL Developer, meet “Quan” (aka the MySQL Query Analyzer) iBot MySQL DevZone RSS 0 05-15-2009 01:30 PM
MySQL University - Training on MySQL Development & Internals iBot Solaris BigAdmin RSS 0 11-12-2008 09:10 AM
join (pls help on join command) summer_cherry Shell Programming and Scripting 1 12-31-2007 05:19 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-07-2009
noratx noratx is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 30
MySQL Join

Hey!

I hope to find someone who can help me with a join question. I just can't figure it out.

I have (among others) three tables in the database "CastControl".

They are named "cc_users", "cc_plan" and "cc_servers".

In cc_users, (among others) is a row named "username" and another named "credits".
In cc_plans, (among others), is a row named "price" and another named "id"
In cc_servers, (amon others), is a row named "portbase" and anothe named "plan".

I need to ask the database for cc_server.portbase and the get the values for cc_users.credit, cc_users.owner and cc_plans.cost

The relations (as I know them) are the following:

cc_users.username relates to cc_servers.owner
cc_servers.plan relates to cc_plans.id

cc_plans have no relations to cc_users or vice versa.

I hope I can make myself understood with this. If there is anything you need to know in order to assist me. please don't hesitate to ask.
I just have no clue of have to get out the values.


If you need to see the structure of the tables, see the following files:

http://dev.gate5.se/cc_plans.txt
http://dev.gate5.se/cc_users.txt
http://dev.gate5.se/cc_servers.txt
  #2 (permalink)  
Old 10-07-2009
varontron varontron is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 110
your description was a little out of whack with fieldnames and such, but I think this is what you want. substitute a value for the '?'
Code:
select 
  u.credits, 
  u.username,
  p.cost
from
  cc_servers s
  join cc_plans p on s.plan = p.id
  join cc_users u on s.owner = u.username
where
  s.portbase = ?
Reply

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:19 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0