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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:01:22+00:00 2026-05-26T13:01:22+00:00

I have 2 tables, named subscriptions and tags . Once in a month I

  • 0

I have 2 tables, named subscriptions and tags. Once in a month I will have to create tags for each order.

I have to list subscriptions without a tag for the given month (2011-10-01 or 2011-09-01 etc). This query returns 0 records:

   SELECT s.id, s.active, s.status 
     FROM asw_subscriptions as s 
LEFT JOIN asw_tags as t ON s.id = t.subscription_id 
    WHERE t.subscription_id IS NULL 
      AND t.deliveryDate = '2011-10-01' 
      AND s.status = '2' 
      AND s.active = '1' 
 ORDER BY s.id DESC 
    LIMIT 0, 25

Table Structure


subscriptions = id (int / auto), active (enum : 0,1), status (enum : 0,1)

tags = id (int / auto), deliveryDate (date), tagNumber

  • 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-26T13:01:22+00:00Added an answer on May 26, 2026 at 1:01 pm

    The problem is in clausule

    t.deliveryDate = '2011-10-01' AND
    

    You have not record on the left because condition ‘IS NULL’ eliminates LEFT JOIN’ed records.
    So, above condition will eliminate all join products, because will never be true (there will be always null in t.deliveryDate.

    Try something like this:

    SELECT s.id, s.active, s.status 
         FROM asw_subscriptions as s 
    WHERE s.status = '2' 
          AND s.active = '1' 
          AND NOT EXISTS (
             SELECT 1
             FROM asw_tags as t
             WHERE s.id = t.subscription_id
             AND t.deliveryDate = '2011-10-01'          
          )
     ORDER BY s.id DESC 
        LIMIT 0, 25
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tables named news and tags_news. Given a news id I have to
I have tables named: Posts_August_2011 Posts_September_2011 Posts_October_2011 Posts_November_2011 Posts_December_2011 Posts_January_2012 I want to create
I have 2 database tables named Categories and SubCategories and I want to create
Have two tables named Employee and Order. The relations between the tables Employee (1)
I have two tables, events and locations . Each has a column named venue_id
I have two tables named MEMBER - columns id(primary key), name, email & TOPICS
I have 4 tables named wheels , tires , oil_change , other_servicing . Now,
Let's say you have three tables named Item, Event, and Seat, constructed as such:
I have two tables, both named as say, Employee in two different schema HR
I have an old database (with terribly named tables and columns) and an entity

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.