user3673405 user3673405 - 1 year ago 103
MySQL Question

Query two row database

I have two tables in a database
This is the Users table.
Users Table
This is the UserGroups table.
User Groups Table
Currently I have this query.

SELECT userID,name,email,role FROM swcr_users

The problem is that I need to query the database to display the user. I want to select the group associated with a user. However, I want the query to display the group's name instead of the group id.

Answer Source
Select u.userID,,, r.title from _users u inner join swcr_roles r on (role=groupID);

I am assuming your roles table is called prefix_roles. I can provide help in Spanish aswell if you need so. (Si prefieres que escriba en espaƱol puedo ayudarte)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download