473,788 Members | 2,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

5 tables need help with LEFT JOIN SQL!!

Hi all,

I am working with a computer hardware asset database and I am trying to get
information out of it for each PC in my organisation.

Here is the basic table structure:

Table1 -> Table2 -> Table3
-> Table4 -> Table5

Table1 is the master, table2 and table4 a linking tables to table3 and
table5

This is what I am trying to do:

select table1.name, table3.TotalVis ibleMemory, table5.label from (LEFT JOINS
HERE)

I have successfully retrieved the information from table 3 using this SQL:

select table1.name, table3.TotalVis ibleMemorySize
from
(table1 LEFT OUTER JOIN table2 ON (table1.id$=tab le2.GroupCompon ent))
LEFT OUTER JOIN table3 ON (table2.PartCom ponent=table3.i d$)
order by table1.name;

NOW, if I wanted to add a field table5.label how would I add the 2 LEFT
OUTER statements to this SQL?

I hope someone can help.

Thanks,

Vypre

Jul 20 '05 #1
1 6928
Justin Hennessy wrote:
select table1.name, table3.TotalVis ibleMemorySize
from
(table1 LEFT OUTER JOIN table2 ON (table1.id$=tab le2.GroupCompon ent))
LEFT OUTER JOIN table3 ON (table2.PartCom ponent=table3.i d$)
order by table1.name;

NOW, if I wanted to add a field table5.label how would I add the 2 LEFT
OUTER statements to this SQL?


I'm not sure why you're using an outer join between the linking table
and table3.

I'd try writing the query in the following way:

SELECT table1.name, table3.TotalVis ibleMemorySize, table5.label
FROM table1 LEFT OUTER JOIN
(table2 INNER JOIN table3 ON table2.PartComp onent = table3.id$)
ON table1.id$ = table2.GroupCom ponent
LEFT OUTER JOIN
(table4 INNER JOIN table5 ON table4.someFiel d = table5.id$)
ON table1.id$ = table4.someOthe rField
ORDER BY table1.name

Of course, replace someField and someOtherField with the actual fields
in table4 that you use to link to table1 and table5.

Regards,
Bill K.
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1777
by: R. Tarazi | last post by:
Hello, DB-structure: ========= firmendaten ----------------- firmendatenid <- firmennummer name strasse
1
5640
by: Eric | last post by:
Hi Folks, Lets assume I have three tables. Their layout is as follows. Please note that tblPeople does not have an entry for Denver (this is my problem) tblCity _________________ CityName OCID LA 1 Denver 2
6
2574
by: Allan | last post by:
Please help, below is my problem. Let's say I have 2 tables, a Products table and a Colors table that go as follow: Table Products prodID Name 1 shirt 2 tshirt
7
9340
by: deko | last post by:
SELECT tblTxAcct.TxAcctName, tblTxType.TxTypeName, Nz(qryTxAcctListCt.TxCount, 0) AS TxCt FROM (tblTxAcct INNER JOIN tblTxType ON tblTxAcct.TxType_ID=tblTxType.TxType_ID) LEFT JOIN qryTxAcctListCt ON tblTxAcct.TxAcct_ID=qryTxAcctListCt.TxAcct_ID; I use this query as a RecordSource for a Datasheet that displays Accounts, Types, and the number of Transactions in each Account. An Account cannot exist outside of a Type, but an Account...
5
3358
by: man7 | last post by:
Hi Im having problems migrating a query from Oracle to MS Access..after much modification i arrived at this query: SELECT t4.org_nm, t1.run_id, t3.org_id, t1.Plan_Yr_n, t2.plan_id, t3.Opt_Out_i, (IIf(t3.Prod_ty_c="EPO","HMO",t3.Prod_ty_c)) as Product, t3.bus_ln_c, t3.FUND_TY_C, t2.orig_plan_c, t2.orig_plan_nm FROM (((BENEXCH_T_RIBT_BTCH t1
2
1338
by: eurolinux | last post by:
I'm trying to left join a table where there are two identical fields I want to select all records in a field from the left table and only those records from the identical field of the right table which are not bigger or smaller then 1 both field in the tables are integer data type Can someone help
0
1205
by: sixtus | last post by:
I need a little help. I have 3 Mysql tables: Week (with columns day and hour) Activity (with columns day, hour, activityid and ac_text) Person (with columns name and activityid) I would like to create a scheme showing the activities during a week sorted on days and hours. If I ignore the person table I can fix it with the statement: Select …. From week left join activity on (week.day = activity.day) and (week.hour = activity.hour)...
9
1744
by: chadlupkes | last post by:
I'm getting NULLs where there shouldn't be. Any help is appreciated. Here are the tables: precinct Field Type Null Key Default Extra id smallint(6) PRI NULL auto_increment precinct_number int(11) 0 precinct_name varchar(20) MUL
1
4040
by: naveenchhibber | last post by:
Hi all pls tell me that the following statment is valid in oracle 9i or 10g.. update ws set received_by_facility = coalesce(rbf_ouk.organizational_unit_id, 0), assigned_to_facility = coalesce(atf_ouk.organizational_unit_id, 0), received_by_team = coalesce(rbt_ouk.organizational_unit_id, 0), assigned_to_team = coalesce(att_ouk.organizational_unit_id, 0)
0
9656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10172
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8993
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.