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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:06:59+00:00 2026-05-22T03:06:59+00:00

First off, sorry if this is a near enough duplicate. I’ve found this question

  • 0

First off, sorry if this is a near enough duplicate. I’ve found this question, which nearly does what I want, but I couldn’t wrap my head around how to alter it to my needs.

I’ve got these 3 tables:

cs_Accounts:

+----+-----------------------------+-------------+
| id | email                       | username    |
+----+-----------------------------+-------------+
| 63 | jamasawaffles@googlil.com   | jamwaffles2 |
| 64 | jamwghghhfles@goomail.com   | jamwaffles3 |
| 65 | dhenddfggdfgetal-pipdfg.com | dhendu9411  |
| 60 | jwapldfgddfgfffles.co.uk    | jamwaffles  |
+----+-----------------------------+-------------+

cs_Groups:

+----+-----------+------------+-------------+
| id | low_limit | high_limit | name        |
+----+-----------+------------+-------------+
|  1 |         0 |          0 | admin       |
|  2 |         1 |         50 | developer   |
|  3 |        76 |        100 | reviewer    |
|  4 |        51 |         75 | beta tester |
|  5 |         1 |         50 | contributor |
+----+-----------+------------+-------------+

cs_Permissions:

+----+---------+----------+
| id | user_id | group_id |
+----+---------+----------+
|  4 |      60 |        4 |
|  3 |      60 |        1 |
|  5 |      60 |        2 |
|  6 |      62 |        1 |
|  7 |      62 |        3 |
+----+---------+----------+

I’ve been wrestling with a 3 way join for hours now, and I can’t get the results I want. I’m looking for this behaviour: a row will be returned for every user from cs_Accounts where there is a row in cs_Permissions that contains their ID and the ID of a group from cs_Groups, as well as the group with the group_id has a high_lmiit and low_limit in a range I can specify.

Using the data in the tables above, we might end up with something like this:

email                         username      cs_Groups.name
----------------------------------------------------------
jwapldfgddfgfffles.co.uk      jamwaffles    admin
jwapldfgddfgfffles.co.uk      jamwaffles    developer
jwapldfgddfgfffles.co.uk      jamwaffles    beta tester
dhenddfggdfgetal-pipdfg.com   dhendu9411    admin
dhenddfggdfgetal-pipdfg.com   dhendu9411    reviewer

There is an extra condition, however. This condition is where rows are only selected if the group the user belongs to has a high_limit and low_limit with values I can specify using a WHERE clause. As you can see, the table above only contains users with rows in the permissions table.

  • 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-22T03:06:59+00:00Added an answer on May 22, 2026 at 3:06 am

    This feels a lot like homework but with a name like James I’m always willing to help.

    select a.email,a.username,g.name
    from cs_Accounts a
    inner join cs_Permissions p on p.user_id = a.id
    inner join cs_Groups g on g.id = p.Group_id
    where g.low_limit > 70
    and g.high_limt < 120
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off, I am sorry if this is a duplicate, but every time I
First off, sorry if this is a stupid question. I installed code::blocks to try
First off, I'm sorry for asking such a simple question in such a sophisticated
First off, sorry for the lame title, but I couldn't think of a better
First time poster so sorry if this is too long, but I've hit a
First off, I'm rather n00b at AS3 so I'm sorry if this is a
First off, sorry for the cryptic question. My team is currently using Selenium 2.0rc3
First off - sorry for the wall of code but it's not too horrendous,
This is an absolute beginner's question (sorry), but I was wondering how to commit
First off, I'm sorry if the title doesn't explain this very well. I'm looking

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.