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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:59:04+00:00 2026-06-14T00:59:04+00:00

I have to a table like this Year Month 2012 8 2012 7 2012

  • 0

I have to a table like this

Year Month
2012  8
2012  7
2012  4
2012  3
2011  7
2011  3
2011  1
2010  10
2010  9
2010  8

This tables show which month and year is remaning, now let say I have completed 2012, 7 month. Now I want to have list like

Year Month
    2012  8
    2012  4
    2012  3
    2011  7
    2011  3
    2011  1
    2010  10
    2010  9
    2010  8

I am using below query but this is not giving me the correct records

SELECT YEAR, MONTH from tablex
WHERE Year NOT IN (SELECT DISTINCT YEAR from OTHER_TABLE INNER JOIN Some_Other_Table)
AND  MONTH NOT IN (SELECT DISTINCT MONTH FROM OTHER_TABLE INNER JOIN Some_Other_Table)

When OTHER_TABLE is null then I am getting the currect count, but when Other table has year 2012 and month 7 I am getting no results.

P.S.: There is no joining columns available for tablex and OTHER_TABLE and Som_Other_Table

  • 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-06-14T00:59:05+00:00Added an answer on June 14, 2026 at 12:59 am

    You just have to use NOT EXISTS:

    SELECT YEAR, MONTH 
    from tablex t1 
    WHERE NOT EXISTS
    (
        SELECT 1 FROM OTHER_TABLE t2
        WHERE t2.Year = t1.Year AND t2.Month = t2.Month 
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that looks like this: Month | Year | Rate 2011
I have table like this create table tbl_1( year int, month int, day int
I have a table that looks like this: Name Job Year ImpFile ImpDate ------------------------------------------------
I have a table that looks something like this: Name Year Value A 2000
I have a table that looks like this: ------------------------------------------------------------------- CUSTNUM (INT), ITEMNUM (INT), MONTH
I have table like this: CREATE TABLE Date_Table (Year DATETIME , Month1 INTEGER, Month2
I have an Excel table like this date (A) value (B) 1 2012-09-01 1
I have table like this : ID Name_1 Name_2 Name_3 1 Egon Spengler Ives
I have a table like this ID Name IsDeleted 1 Yogesh Null 2 Goldy
I have a table like this : +-------+------------+------+-----+---------+-------+ | Field | Type | Null

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.