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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:36:17+00:00 2026-06-02T23:36:17+00:00

I have a comments and friends table in mySQL database. The comments table contains

  • 0

I have a comments and friends table in mySQL database.

The comments table contains the following columns:

member_id, comment_id, comment, video_id

The friends table contains the following columbs:

member_id, member_id_friend

Is there a query to select all comments from your friends in a specific video id?

Thank you!

  • 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-02T23:36:19+00:00Added an answer on June 2, 2026 at 11:36 pm

    When you create a table like friends, it’s called a “join table”. These are used for many-to-many relationships between items. The way your particular schema is set up, the friends table is a join table implementing the many-to-many relationship between members and other members (their friends), so some would call it a “self-join table”.

    Tables like this are called join tables because the way to get relevant data from them is to “join” them to other tables. This is because they don’t, themselves, contain any real data to speak of.

    If you’re trying to get the collection associated with an individual in a many-to-many relationship, you typically use an “inner join”, which restricts results from one table to records which have a match in the join table. In this case, it’d look like:

    select * from comments c
    inner join friends f on c.member_id = f.member_id
    where f.member_id_friend = [current user ID]
      and c.video_id = [desired video ID]
    

    Let us know how that works for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my current project, Workflows have comments. Please have a look at the following
A user can create a post. Posts have comments. A comment must belong to
I have a table (session_comments) with the following fields structure: student_id (foreign key to
I have a system of comments, and each comment has a button that normally
I have used the following as comments in my .emacs // {{{ // }}}
My database have got 4 table : users id username images id user_id image
I have the following tables in the database. users ----------------- | id | username
I have the following tables in the database. users ----------------- | id | username
I have a status update, and comment db table. A user has many status
friends. I have a page, on which users can add comments (users can enter

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.