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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:18:00+00:00 2026-05-26T13:18:00+00:00

SELECT user_id FROM user_accounts INNER JOIN roles_users ON (user_accounts.user_id = roles_users.user_id) WHERE roles_users.role_id IN

  • 0
SELECT user_id FROM user_accounts 
INNER JOIN roles_users
ON (user_accounts.user_id = roles_users.user_id)
WHERE roles_users.role_id IN (1)

Is what i tried.

What i wish is to select all users user_id, that are only a user (role_id 1). In my application everyone has role_id 1, and then they got a new row with their user_id and role_id with either 2,3,4 if they are a partner,admin,etc.

So how can i select all users user_id that ONLY have 1 row in roles_users, with the role_id 1?

MySQL

  • 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-26T13:18:00+00:00Added an answer on May 26, 2026 at 1:18 pm
    SELECT user_accounts.user_id, COUNT(roles_users.user_id) AS cnt
    FROM user_accounts
    INNER JOIN roles_users ON (user_accounts.user_id = roles_uers.user_id)
    GROUP BY user_id
    HAVING (cnt = 1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have the following: $query = SELECT user_id,email,password, roles.role_id,role_name FROM users JOIN roles
I have a query like this SELECT user_id FROM user WHERE user_id NOT IN
This problem is baffling me: BEGIN; INSERT INTO sub_users(user_id, email) SELECT user_id FROM users
I retrieve data from db like that: select * from MOVIE_COMMENT where USER_ID =
select * from users, awards where (users.id = awards.user_id) and awards.trophy_id not in (select
SELECT * FROM support_systems,tickets INNER JOIN user_access ON tickets.support_system_id = user_access.support_system_id WHERE support_systems.account_id =
I have the following query: UPDATE lessonstatus INNER JOIN user ON lessonstatus.user_id = user.user_id
cursor.execute(SELECT user_id FROM myapp_location WHERE\ GLength(LineStringFromWKB(LineString(asbinary(utm), asbinary(PointFromWKB(point(%s, %s)))))) < %s\ ,(user_utm_easting, user_utm_northing, 500)); This
SQL: select * from user where room_id not in (select id from rooms); what
SELECT user_id, created FROM photo_comments GROUP BY user_id returns user_id created 1 2009-10-20 21:08:22

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.