473,503 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Left Join doesn't display the records I expected.

1 New Member
Hi all,
I have a SQL query with all left joins. However, the left most table tClient wasn't displayed if it gets null from the right table.

The linking is something like tClient --> tPOin --> tPOItems --> tDelivered

The query is exactly like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT EName, Sum(tPOItems.Charge*tDelivered.DQuantity) AS Amount 
  2. FROM tClient left JOIN (tPOin left JOIN (tPOItems left JOIN tDelivered ON tPOItems.ID=tDelivered.POItemsID) ON tPOin.ID=tPOItems.POinID) ON tPOin.ClientID=tClient.ID WHERE InvoiceID Is Not Null And CalcMonth=Forms!fGenMonthlyStatement.bCalcMonth And CalcYear=Forms!fGenMonthlyStatement.bCalcYear 
  3. GROUP BY tClient.EName; 
  4.  
The result is, for example:

Company A, $68012
Company C, $133000

However, I'd like to have Company B displayed but it doesn't.

Can someone please help me.

Thanks in advance.
Sep 20 '10 #1
2 1016
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
My guess would be that it is related to the:
Expand|Select|Wrap|Line Numbers
  1. WHERE InvoiceID Is Not Null 
Have company B placed any orders?
Sep 20 '10 #2
Oralloy
988 Recognized Expert Contributor
Try removing the grouping function SUM, and just display all the interesting columns.

Then, when you've massaged the querty to give you the desired records, then you can re-implement the grouping SUM.

Cheers!
Sep 20 '10 #3

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

Similar topics

13
2618
by: StealthBananaT | last post by:
My database has two tables - films has 10,000 records and reviews has 20,000 records. Whenever I try to list all the films and the count of its reviews, MySQL locks and I have to restart the...
1
3430
by: Paul Bramscher | last post by:
Here's one for pathological SQL programmers. I've got a table of things called elements. They're components, sort of like amino acids, which come together to form complex web pages -- as nodes...
2
2729
by: Scott Snella | last post by:
Hi, I hope this is the right place to post, but, I am having a problem with an UPDATE command and a LEFT JOIN, I am using something like: UPDATE table_a LEFT JOIN table_b ON...
8
2505
by: niceguy | last post by:
I'm trying to select records from two tables. the following code works for what i want to to: set RSMain = conn.execute ( "select top 20 product, prodcode, edition, ( select count(id) from...
2
6378
by: Ryan | last post by:
I'm going daft. I have what should be a simple query and it seems that the left side of the join is being ignored. The query and DDL are below. Basically, my RDOData_Extract_Lines table (where...
3
1605
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
9
3191
by: Alan Lane | last post by:
Hello world: Background: Yesterday, January 21, Doug Steele was kind enough to help me out on a Left Join problem. I was trying to return all stores and their Gross Adds for December, 2004...
14
6078
by: Ryan | last post by:
I want to do the following SQL statement in Access. However, it won't allow me to have the secondary part of my join statement and tells me that this is not supported. OK, so Access doesn't support...
2
1285
by: New Guy | last post by:
I created this query in Access with the Design View. SELECT Fiscal_Period.FiscalKey, Invoice.type, Invoice.accid, Sum(Invoice.Total) AS Amount FROM Fiscal_Period LEFT JOIN Invoice ON...
2
1914
dlite922
by: dlite922 | last post by:
I've heard this may not be possible, but never hurts to ask. I've got three tables, Case, Violator, Alias Case is a court police case Violator is the person Alias is different names...
0
7205
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
7093
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...
1
7006
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
7467
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
5592
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,...
1
5021
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...
0
4685
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...
1
744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
397
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...

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.