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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:38:53+00:00 2026-06-12T15:38:53+00:00

I have 4 tables… users, friends, articles & article_shares (as in written) A user

  • 0

I have 4 tables… users, friends, articles & article_shares (as in written)

A user can share an article they have created by simply inviting them to read it. What I’m trying find is a list of friends of the article creator (id 63) who have not been invited to share the article yet (id 34).

So, table users:

user_id - name 
10         Dan
11         Doug
12         Chad
13         Ben
63         John

table friends

user_id - friends_id
63        10
63        11
63        12
63        13

table articles

article_id - user_id_creator
34           63

table article_shares

article_id - user_id_sharedWith
34           10
34           11

From the data above I want to return users with id 12 & 13.. chad & ben

Here’s what I’m trying:

select u.name, u.user_id, u.live_prof_pic from users u
join friends f on f.user_id = u.user_id 
join articles a on a.user_id_creator = f.friends_id
join article_shares as on as.articl_id <> a.article_id
where ((f.friends = '63') && (a.article_id = '34'))

It is simply returning 0

Any ideas?

  • 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-12T15:38:54+00:00Added an answer on June 12, 2026 at 3:38 pm

    Give this a try,

    SELECT  c.friends_ID
    FROM    articles a
            INNER JOIN users b
                ON a.user_Id_creator = b.user_ID
            INNER JOIN friends c
                ON b.user_ID = c.user_ID
            LEFT JOIN article_shares d
                a.article_ID = d.article_ID
    WHERE   b.user_ID = 63 AND
            a.article_ID = 34 AND
            d.article_ID IS NULL
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tables: user, comment and post, say: A user can have many posts
I have tables A, B, C, where A represents items which can have zero
I have tables Users, Widgets and Layouts. Users have many-to-many relationship with Widgets via
I have tables & data like this: venues table contains : id +----+---------+ |
I have tables contracts and users and i need to show contracts sorted by
I have tables of reviews, venues and users. I currently have a _review.html.erb partial
i have tables driver, cars and trailers they are all in relationship. and main
I have tables Users, Locations and Follows, where Users have_many locations :through => :follows.
I have tables: users with the fields id, premium votes with the fields userid,
If I have tables like this: ImportSet1.Users ImportSet2.Users ImportSet3.Users Then in my sproc I

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.