MySQL Forums
Forum List  »  Newbie

Left Join not returning row when right side is null???
Posted by: Terry R
Date: February 16, 2015 01:57AM

Trying to understand why Left Join doesn't work in the Single Query below ... given an existing database with 2 tables joined by ID ... where each ID could have 1 or 2 Members:

Member:
ID as Integer
Name as Text
Type as Integer

Balances:
ID as Integer
Status as Text
Balance as Float

The query listed below will only return rows when ID's have 2 members
Yet if I create 3 Queries, left join returns rows with both 1 or 2 members ... ie if the Crew is null no row is displayed with the query below

Q1) Member Left Join to Balances with Member.type = 0 and Status = "Active"
Q2) Member.type = 1 and Status = "active"
Q3) Q1 left join Q2

Single Query (generated in FlySpeed lite):

Select
[Balances].ID,
[Member].Name As Skip,
[Member1].Name As Crew,
[Balances].Balance
From
([Member] Inner Join [Balances] On [Member].ID = [Balances].ID)
Left Join [Member] [Member1] On [Member1].ID = [Balances].ID
Where
[Balances].Status = "Active" And [Member].Type = 0 And [Member1].Type = 1;

Options: ReplyQuote


Subject
Written By
Posted
Left Join not returning row when right side is null???
February 16, 2015 01:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.