many to many relationship on advanced search

Hi,

I created 3 tables:

User

User-Group

Group

Where i can have a many-to-many relationship.

But how i create on the search method a find to it?

How i get all users that have a specific group, like




select u.* from users as u, user-group as ug, group as g where g.name="group_1" and ug.group_id=g.id and ug.user_id = u.id ?



Thanks

up