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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:54:09+00:00 2026-05-30T01:54:09+00:00

Tables: Admin Id | User | Pass Modules Id | Name (ex. users, admin,

  • 0

Tables:

Admin
Id | User | Pass

Modules
Id | Name (ex. users, admin, gallery )

Permissions
Id | Name (ex. add, delete, read, update)

Levels
Id | Module (ex. gallery) | Cod_Permission (ex. 10) | Administrator (ex. user123)

So an I have query:

SELECT
 n.Modulo,
 p.Nome AS Tipo,
 n.Administrador AS Nome,
 n.Cod_Permissao
 FROM
 niveis AS n
 Inner Join modulos AS m ON n.Modulo = m.Nome
 Inner Join permissoes AS p ON n.Cod_Permissao = p.Codigo
 WHERE
 n.Administrador =  'user123'

Return:

Id -> Module -> Cod_Permission -> Administator
 1    gallery    1    user123
 2    gallery    2    user123

I want group all results for same module in one line like this

Id -> Module -> Read -> Update -> Delete -> Insert -> Username
 1   gallery    1    0    0    4    user123

How to make this?

  • 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-30T01:54:10+00:00Added an answer on May 30, 2026 at 1:54 am

    Something like this –

    SELECT
        n.Modulo,
        p.Nome AS Tipo,
        n.Administrador AS Nome,
        SUM(IF(n.Cod_Permissao = 1, 1, 0)) AS Read,
        SUM(IF(n.Cod_Permissao = 2, 1, 0)) AS Update,
        SUM(IF(n.Cod_Permissao = 3, 1, 0)) AS Delete,
        SUM(IF(n.Cod_Permissao = 4, 1, 0)) AS Insert
    FROM niveis AS n
    INNER JOIN modulos AS m
        ON n.Modulo = m.Nome
    INNER JOIN permissoes AS p
        ON n.Cod_Permissao = p.Codigo
    WHERE n.Administrador = 'user123'
    GROUP BY
        n.Modulo,
        p.Nome,
        n.Administrador
    

    Without knowing exactly what the different fields are I cannot be 100% sure but this should get you heading in the right direction.

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

Sidebar

Related Questions

I have three tables: Users, Groups and GroupsUsers User table: id: 1 username: admin
Django administration view automatically generates permissions for all modules and tables - admin, auth,
I'm developing a new admin website to update several tables. There is no complicated
im using extJS 3.0.0, rails 2.3.11, ruby 1.8. tables: users -> id, name, is_admin
I have two tables: Users and Profiles. A user may have a profile and
If i have two tables like user table-u userid | name 1 | lenova
Take tables: User, Comment, Snippet. A User can have many Snippets. A Snippet can
I've developed a module which allows the user to upload images to a little
I reworked my database from one user table to multiple user tables (divided per
Hi Experts How I can prevent database user deleting any data in tables using

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.