473,424 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,424 software developers and data experts.

how to join 3 or more tables in sql server

3
Hi,,


I have a 4 tables need to join and retrieve the data...

Table 1

Tid - PK
Tname
a3
a4
a5

Table 2
Tid - FK
Tname
Lid-FK
Eid-FK
b3
b4
b5

Table3
Lid -PK
Lname
c3
c4

Table4

Eid - Pk
Ename
d2
d3
d4


SELECT Table1.Tid, Table1.Tname, Table2.b3, Table2.b4, Table2.b5,
Table3.Lname, Table4.Eid, Table3.Lid,Table4.Lname, Table4.Fname
FROM Tools LEFT OUTER JOIN
Table2 ON Table2.Tid = Table2.Tid LEFT OUTER JOIN
Table3 ON Table2.Lid = Table3.Lid LEFT OUTER JOIN
Table4 ON Table2.Eid = Table4.Eid

when i am executing this only Tid and Tname columns are displaying.....


please help me out...
thanks in advance
Apr 1 '10 #1
1 2073
ck9663
2,878 Expert 2GB
Not displayed? Or it's displaying but showing NULL? If it's showing NULL, it could mean there's no matching record on that table.

Happy Coding!!!

~~ CK
Apr 1 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: B. Fongo | last post by:
I learned MySQL last year without putting it into action; that is why I face trouble in formulating my queries. Were it a test, then you would have passed it, because your queries did help me...
4
by: eXavier | last post by:
Hello, I have query joining several tables, the last table is joined with LEFT JOIN. The last table has more then million rows and execution plan shows table scan on it. I have indexed columns...
2
by: Bill | last post by:
I have the following situation. We sell books on our website, and some of the books have more than one author. So I needed to create a many-to-many table, which is the intermidiate table between...
0
by: Preston Landers | last post by:
Hello all. I am trying to write a query that "just" switches some data around so it is shown in a slightly different format. I am already able to do what I want in Oracle 8i, but I am having...
1
by: tekanet | last post by:
Hello folks, first of all I really don't know how you gurus call this way of writing joins: SELECT A.FIELD, B.FIELD FROM TABLE_A A, TABLE_B B
2
by: Bennett Haselton | last post by:
I know how to create a DataAdapter that loads data from a data source into a table in a typed DataSet, and how to set the DataSource and DataMember properties of a DataGrid so that at run time it...
4
by: DraguVaso | last post by:
Hi, For my VB.NET application I have the following situation: 2 tables on my SQL Server: tblAccounts and tblRules. For each Account there are many Rules (so tblRules is linked to my tblAccounts...
7
by: germanshorthairpointer | last post by:
Hello, I'm trying to do a join based on the following tables: Person(person_id,person_name) Grade(grade_id,grade_person_id,grade_score) The data looks like this: Person:
3
by: Martini | last post by:
Hello all. I have quite disturbing situation where I am not happy about the way how SQL handles the query. Situation is related to using user function in INNER JOIN select. Although the problem...
0
by: katupilar | last post by:
I am writing a tool to interface with a couple of tables in SQL Server 2000. I usually write my queries with an Inner Join to bring in fields from seperate tables and load that to a DataSet. I'm...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.