Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3352296
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:00:46+00:00 2026-05-18T02:00:46+00:00

Google hasn’t helped me here nor has Microsoft online help yet. I have Inline

  • 0

Google hasn’t helped me here nor has Microsoft online help yet.

I have Inline tables which are generated as a subquery. (See simplified code below, I have several more inline tables.)

Now, this is fine where I have data. However, there are cases where I need to return results when there isn’t data. For example, Inline table 1 returns my number of active customers… If I specifiy a range where there are no active customers I get no results for the whole query.

This is due to my join (AND IL1.transaction_id = th.transaction_id)

How can I left join the inline table?

I tried LEFT JOIN IL1 on il1.transaction_id = th.transaction_id but it says the table doesn’t exist.

select  SUM(th.total_net_retail_central) as 'Net Purchases  TY', 
            IL1.Active as 'Number of Active Customers TY',
            COUNT(th.transaction_id) as 'Number of Transactions TY'

FROM        

(SELECT transaction_type, COUNT(DISTINCT customer_id) as 'Active' from transaction_header  
where transaction_date BETWEEN @Active and @ToDate group by transaction_type)IL1, 
transaction_header th

INNER JOIN transaction_type tt ON th.transaction_type = tt.transaction_type
WHERE 
th.transaction_date Between @FromDate AND @ToDate

AND         IL1.transaction_type = th.transaction_type

GROUP BY 
            tt.transaction_type_description, IL1.Active

Any help is really appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:00:46+00:00Added an answer on May 18, 2026 at 2:00 am

    You shouldn’t mix implicit and explicit joins, you may get inconsistent results. Also well frankly you should never use an implicit join.

    See if this works for you:

    SELECT  SUM(th.total_net_retail_central) AS 'Net Purchases  TY',  
                COALESCE(IL1.Active, 0) AS 'Number of Active Customers TY', 
                COUNT(th.transaction_id) AS 'Number of Transactions TY' 
    
    FROM     transaction_header th      
    INNER JOIN transaction_type tt 
        ON th.transaction_type = tt.transaction_type 
    LEFT JOIN (SELECT transaction_type, COUNT(DISTINCT customer_id) AS 'Active' 
                FROM transaction_header   
                WHERE transaction_date BETWEEN @Active and @ToDate 
                GROUP BY transaction_type)IL1
        ON  IL1.transaction_type = th.transaction_type 
    WHERE  th.transaction_date BETWEEN @FromDate AND @ToDate 
    GROUP BY  tt.transaction_type_description, COALESCE(IL1.Active, 0)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Google hasn't been a help.
Google's not coming to my rescue, here, and I just know this is the
Google is failing me on this one. Let's say I have some ECMA script
Google/MyBrain are failing me. Without using a framework (which I'll never get past my
Does Google force employees who have offers from Facebook to leave immediately?
It looks like Google hasn't updated the results section since the Q4 2009 posting.
Sometimes I'd like to know the reasoning of certain API changes. Since Google hasn't
I have a as to how google's async analytics tracker works. The following code
As mentioned briefly in this article: http://en.wikipedia.org/wiki/Delta_encoding#Delta_encoding_in_HTTP which is referenced from here: https://www.rfc-editor.org/rfc/rfc3229 I'm
A simple question but a google and SO search hasn't turned anything up. Does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.