Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Accessing data from different tables

Author  Topic 

azharrahi
Starting Member

44 Posts

Posted - 2006-06-15 : 08:59:19
Here Is the Scenario:

There are 4 tables (I will show here only necessary fields , remaining ignored)

LMUserType (UserTypeID (int,auto-gen), UserType (varchar), UserID int))
Coaches ( CoachID (int), CoachName(varchar),..)
Players (PlayerID (int,auto-gen),PlayerName(varchar),..)
Referees (RefereeID (int,auto-gen), RefereeName(varcha),..)

Here is The Data In LMUserType Table

UserTypeID UserType UserID
9 Coaches 4
10 Referees 1
11 Referees 4
12 Players 3
13 Players 1
14 Players 8
15 Players 6

Now I want to select the data from the remaining three tables

through the LMUserType, such that when usertype = coaches

and userid = 4 , then it must go to 'Coaches' table and select the

data and then go to next row of LMUsertype and check that

usertype= referees and userid = 4 and it must go to Referees table

and select data from Referees and so on

Is it Possible, If yes Then kindly tell me as soon as possible ?

Azhar Rahi
Software Engineer
Eye4tech Pvt Ltd,Lahore
Pakistan

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-06-15 : 09:06:57
You need to use Joins
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -