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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:34:41+00:00 2026-06-04T05:34:41+00:00

I have 4 tables in MySQL USERS USER_INFO USER_RIGHTS 101 = read right 102

  • 0

I have 4 tables in MySQL

USERS

enter image description here

USER_INFO

enter image description here

USER_RIGHTS

enter image description here

101 = read right

102 = write right

103 = delete right

GROUPS

enter image description here

Now when i want to select all users using INNER JOIN i do something like

SELECT users.id, user_info.first_name, user_info.last_name, user_rights.right
    FROM `users`
INNER 
    JOIN user_info 
    ON users.id = user_info.user_id
ORDER BY user_info.first_name;

and i get 2 users.

I want to make another INNER JOIN that selects members that have rights in group 1 for example, but my code dosen’t work …

SELECT users.id, user_info.first_name, user_info.last_name, user_rights.right
    FROM `users`
INNER 
    JOIN user_info 
    ON users.id = user_info.user_id
INNER 
    JOIN user_rights 
    ON user_rights.rights = '101' 
ORDER BY user_info.first_name;

The idea is to select what members has the READ right in a certain group. Hope i make myself clear.

  • 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-04T05:34:43+00:00Added an answer on June 4, 2026 at 5:34 am

    use Left Join with User_Rights to get all users and rights

    SELECT users.id, 
           user_info.first_name, 
           user_info.last_name, 
           user_rights.right 
    FROM   users 
           INNER JOIN user_info 
             ON users.id = user_info.user_id 
           LEFT JOIN user_rights 
             ON user_rights.user_id = users.id 
                AND user_rights.right = '101' 
           LEFT JOIN GROUPS 
             ON user_rights.group = GROUPS.group 
                AND groups.group_name = 'Human Resources' 
    ORDER  BY user_info.first_name; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using php and mysql I have two tables, a users table and a profiles
I have MySQL database with two tables: users and items. They look like this:
I have two mysql tables. They are laid out in this manner: user_info id
I have a MySQL table called Users. The rows have 4 fields and look
Lets say I have a MySQL table, Users, like this - ----------------------------------------- ID |
I have names stored in my mysql database i created a table called users
Q: How do I make MySQL only SELECT all users that have played =>
I have two tables, one user_info : table user_info { user_id ; fname; laname;
i have two tables in my database one is to keep users info (users_table
I have the MySQL table with 2 rows that is name for user name

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.