I have a table called users, which has columns username, password, and userlevel. Userlevel is a foreign key that points to another table called userlevels, which has two columns: level and permission.
How do I show the permission side-by side with the user table?
I’ve tried doing:
select username, u.userlevel, l.permission from users u, userlevels l
where l.permission in
(select permission from userlevels x where x.userlevel = l.level)
But this appears to be giving me a bunch of duplicates. Any help would be appreciated. Thanks.
You want to use what’s called an inner join.