Display results even if Joined table doesn't have any matches

  • SELECT Records.Listcode, Records.JulianDate, Records.Records, COUNT(sales_view.JulianDate) AS Sales

    FROM Records INNER JOIN

    sales_view ON Records.Listcode = sales_view.listcode AND Records.JulianDate = sales_view.JulianDate

    GROUP BY Records.JulianDate, Records.Records, Records.Listcode

    HAVING (Records.Listcode = 'LM')

    ORDER BY LEN(Records.JulianDate) DESC, Records.JulianDate DESC

    This is my sql query and it is pulling only 2 results because within both the records table and the sales table it has two matches, but within the records tables I have 224 matches for Listcode "LM". I was wanting to know how I would be able to get with this code I have above to show all the LM listcodes from the records and have a 0 in the Sales column? Hopefully I explained this clear enough, if not please let me know and I will try to re-explain a different or more clear way! Thanks in advance!

  • Never mind I figured it out. I changed it to an Outer Join for the records. Completely forgot to do that!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply