Problems writing a query to join two tables

Posted by Psyche on Stack Overflow See other posts from Stack Overflow or by Psyche
Published on 2011-02-20T22:56:35Z Indexed on 2011/02/20 23:25 UTC
Read the original article Hit count: 234

Filed under:
|

Hello,

I'm working on a script which purpose is to grant site users access to different sections of the site menu. For this I have created two tables, "menu" and "rights":

menu
- id
- section_name

rights
- id
- menu_id (references column id from menu table)
- user_id (references column id from users table)

How can a query be written in order to get all menu sections and mark the ones where a given user has access.

I'm using PHP and Postgres.

Thank you.

© Stack Overflow or respective owner

Related posts about php

Related posts about postgresql