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

  • Home
  • SEARCH
  • 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 7615283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:36:28+00:00 2026-05-31T02:36:28+00:00

I am a bit new to MySQL and trying my hands on learning it.

  • 0

I am a bit new to MySQL and trying my hands on learning it. However I got stuck with an query that goes as follows:
I have 2 tables: Table 1 contains details of lists created by a user. The fields are listid, listname, creatorid, createdat,membercount;
Table 2 stores data of members of each list: The fields are listid, userid;

The query I need to process is as follows: Find out all the pairs of users of the form (u1,u2) where both of the following conditions are satisfied
i. u1 has created at least one list and u2 is a member of that list.
ii. u2 has created at least one list and u1 is a member of that list.

Note: listid in the table 2 is the foreign key for listid in table 1.

  • 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-31T02:36:29+00:00Added an answer on May 31, 2026 at 2:36 am

    How about this?

    SELECT l.creatorid AS u1, u.userid AS u2
    FROM table2 AS u
    INNER JOIN table1 AS l ON l.listid = u.listid
    

    Returns every user from Table2 and the ID of the creator of the corresponding list.

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

Sidebar

Related Questions

I have a MySQL query that selects data from multiple tables and then orders
I'm relatively new to mysql so bear with me. I have a table that
I've done a fair bit of mysql php programming but am pretty new to
I'm a bit new to Papervision3D, and I'm trying to set the alpha level
I'm a bit new to SQL and have trouble constructing a select statement. I
I am a bit new to reusable plugins for jquery. I have ran across
I'm new to the world of MySQL and I'm having a bit of trouble.
I have some CSV data files that I want to import into mySQL. I
I am a little bit new to the PHP/MYSQL arena, and had an idea
Finding it a little bit tedious migrating to the new Mysql Workbench (5.2.22) even

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.