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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:04:50+00:00 2026-05-20T04:04:50+00:00

I have struggle to produce good SQL. It is a relationship part of application.

  • 0

I have struggle to produce good SQL.
It is a relationship part of application.
I have 3 tables : users(‘id’), relationship(‘user_id’, ‘member_id’), relationship_block(‘user_id’, ‘blocked_member_id’)

I would like to get all members belonging to user with user_id that are not blocked.

Records of first table ‘users’ that are in ‘relationships’ table but that are NOT in ‘relationship_blocked’ table.
First 2 i can do with JOIN, but then I want to remove those that are blocked.

Thanx.

edit: found a good info about it here: http://explainextended.com/2010/05/27/left-join-is-null-vs-not-in-vs-not-exists-nullable-columns/

  • 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-20T04:04:51+00:00Added an answer on May 20, 2026 at 4:04 am
    select *
        from users u
            inner join relationship r
                on u.user_id = r.user_id
            left join relationship_block rb
                on r.user_id = rb.user_id
                    and r.member_id = rb.blocked_member_id
        where rb.user_id is null
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im new to linq so i still struggle .... I have a collection of
I've struggled with scope for a few days. I would like to have a
Hello I have the followong struggle in my head. I want a text-field in
I have been having constant struggle with Visual Studio debugger and finally got fed
I'm struggle to find a way to have more than one property of the
I struggle with working with Internet Explorer. Issue one: I have used min-height:100% and
It's very simple task, but I struggle for hours. I have parse xml from
Let's say we have two tables here , posts and comments, the relations is
With C++, I struggle to understand one compilation error. I have this function, with
I have a form which for some questions would ask if something was included

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.