![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 |
|
||||
|
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 = ? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|