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 4092858
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:32:41+00:00 2026-05-20T19:32:41+00:00

So a rough structure of my two tables concered is as follows: Table one:

  • 0

So a rough structure of my two tables concered is as follows:

Table one: Services
services.id
services.name

Table two: Orders
orders.id
orders.item
orders.service

Table one contains a list of services. And table two is a list of orders. I am trying to generate a list of all orders for services from table two (orders) but also include (Zero) the services that haven’t been ordered. I’m aware that that’s where the LEFT JOIN comes but it doesn’t seem to be working at all. It displays most of the services but there’s one or two records (from services) not being displayed. Here’s the query i’m using so far..

Any guidance at all is much appreciated, thanks!

select services.name,count(orders.service)
from services
LEFT JOIN orders ON services.id=orders.service
WHERE item IN (1,2,3,4)
group by statuses.service;
  • 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-20T19:32:42+00:00Added an answer on May 20, 2026 at 7:32 pm

    Your original selection is fine and should allow all records from the services table through. However you’re then restricting this by your where clause. If there was no join for a specific row, item will have a NULL in it which your WHERE clause is filtering out.

    SELECT services.name
       ,COUNT(orders.service)
    FROM services
    LEFT JOIN orders ON services.id = orders.service
    WHERE item IS NULL
        OR item IN ( 1, 2, 3, 4 )
    GROUP BY statuses.service;
    

    Forgive me if slightly wrong, I’m coming from SQL Server background.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm returning JSON with a rough structure like the one below, and I'm trying
Does anyone have a list of rough rule-of-thumb estimators for the various data structures?
EDIT: I'm adding a new rough table model for comment. Is this what you
One-line summary: suggest optimal (lookup-speed/compactness) data structure(s) for a multi-lingual dictionary representing primarily Indo-European
If I have an html document whose rough structure is <html> <head> </head> <body
I've got a database table called 'mesg' with the following structure: receiver_id | sender_id
A rough definition of a data structure is that it allows you to store
I recently did some rough performance measuring on List<> vs [] for an array
I have a very rough workaround for 10 statements using a combination of 2
I am having a rough time trying to wrap my head around the Lucene

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.