Solved

get data from multiple tables

Posted on 2011-03-10
4
391 Views
Last Modified: 2012-05-11
I have two tables
a. manager
b. team

manager table has manager_id,manager_name

team table is the table which contains team member which reports to a manager in manager table.
Team table has 3 columns, manager_id, Team_member_name, Team_member_address

I need to display a result set with column Manager_name, Team_member_address.

Please help
0
Comment
Question by:dojjol
4 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 167 total points
ID: 35096577
I would look at a redesign and self-join.

Create an 'employee' table then have manager_id reference the emp_id.  There are a tone of links on this type of design.

Based on what you have (assuming manager_name is in the manager table):
select manager_name, address from
manager, team
where manager.name=team.manager_name
0
 
LVL 15

Assisted Solution

by:derekkromm
derekkromm earned 167 total points
ID: 35096635
select m.manager_name, t.team_member_address from
manager m
inner join team t
on m.manager_id = t.manager_id
0
 
LVL 24

Assisted Solution

by:jimyX
jimyX earned 166 total points
ID: 35096653
select m.Manager_name, t.Team_member_address from manager m, team t where m.manager_id = t.manager_id;
0
 

Author Closing Comment

by:dojjol
ID: 35129949
not a solution, I was looking for
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This video shows how to recover a database from a user managed backup
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question