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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:34:53+00:00 2026-05-26T08:34:53+00:00

I get customer ids for customers with sites that have appointments in 2011 SELECT

  • 0

I get customer ids for customers with sites that have appointments in 2011

SELECT customers.id
FROM customers 
INNER JOIN sites ON customers.id = sites.customer_id
INNER JOIN appointments ON appointments.site_id = sites.id
WHERE YEAR(appointments.day) = 2011   

I’m looking to get customers who don’t have any appointments in 2011. Confused on how to go about it.

  • 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-26T08:34:54+00:00Added an answer on May 26, 2026 at 8:34 am

    A couple of ways:

    SELECT
        C.id
    FROM
        Customers C
    WHERE
        NOT EXISTS (
            SELECT *
            FROM
                Sites S
            INNER JOIN Appointments A ON
                A.site_id = S.id AND
                YEAR(A.day) = 2011
            WHERE
                S.customer_id = C.id
        )
    

    or:

    SELECT DISTINCT
        C.id
    FROM
        Customers C
    INNER JOIN Sites S ON
        S.customer_id = C.id
    LEFT OUTER JOIN Appointments A ON
        A.site_id = S.id AND
        YEAR(A.day) = 2011
    WHERE
        A.id IS NULL
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, I want to get all rows from the customers table that do NOT
Say I have a table which stores customers order IDs. Such as | Customer
I have code like this var results = (from c in Customers join o
How can I get all products from customers1 and customers2 include their customer names?
We have hibernate-based system and customer wants to get human-readable names of PK and
I can not get logs from some customers, can I use Google Urchin in
I have the following LINQ query that returns two objects from my database. These
I have a project which requires encryption of customer ids. The encrypted value is
I have a fairly complex SQL query that pulls different types of products from
I have to Pull all customers whose ids are in the list I have

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.