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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:59:06+00:00 2026-05-31T04:59:06+00:00

Tables bugs and dependencies looks like this: select * from bugs; +——–+——–+ | bug_id

  • 0

Tables bugs and dependencies looks like this:

select * from bugs; 
+--------+--------+
| bug_id | status |
+--------+--------+
|     20 | NEW    |
|     45 | CLOSED |
|     47 | NEW    |
|     30 | NEW    |
|     50 | CLOSED |
+--------+--------+


select * from dependencies;
+-----------+---------+
| dependson | blocked |
+-----------+---------+
|        20 |      45 |
|        20 |      47 |
|        30 |      50 |
+-----------+---------+

Expected result of join query: 30

What? Extract only 30 from column dependson, table dependencies because 30 is the only ( NEW status ) one which blocks ( col: blocked-50 ) a bug whose status is CLOSED.
Although the dependson entry 20 is blocking 45 which is CLOSED but it also blocks 47 which is not CLOSED.

Note: Both the columns dependson and blocked are foreign key of bug_id.

I tried different queries but not able to get proper one still… Can anybody please help ?

Update: need status only NEW not all.

  • 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-31T04:59:07+00:00Added an answer on May 31, 2026 at 4:59 am

    Try this query –

    SELECT b.* FROM bugs b
      JOIN (
        SELECT
          d.*
        FROM dependencies d
          JOIN bugs b
            ON b.bug_id = d.blocked
        GROUP BY d.dependson
          HAVING COUNT(IF(status = 'CLOSED', status, NULL)) = COUNT(*)
      ) t
      ON b.bug_id = t.dependson
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With tables basically like this: Elements id INT PRIMARY KEY ... Observations id INT
Two tables: table_a ------- table_a_id: (primary, int) table_b ------- table_a_id: (index, int, from table_a)
I'm new on this particular project, and I've been tasked with resolving an issue
I've got three tables. Tickets, ticket history, and classification. I'd like to count how
Is there a way around this in SQL Server 2005? (It bugs me, and
This is related to a chapter from beautiful code . And in that chapter
I'm beeing bit confused here. SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.bugs_list_item, itemCursor, new String[]
This has got to be one of the most frustratingly stupid bugs I have
In my application I use string.Format() for the SQL like this Dim strSQL As
I have a crawler-like software that populates tables after reading and parsing particular web

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.