0

I'd like to select all the users beside the current user in a given group. The relationship between group and user is many-to-many.

At the moment my query selects all users in a given group.

SELECT g.users FROM Group g WHERE g.groupName =:groupName

I didn't manage to get what I wanted, I don't know where to add a condition (in the where clause the condition is not met so I have an empty list of users).

Ced
  • 15,847
  • 14
  • 87
  • 146

1 Answers1

2

You need a JOIN between the 2 entities:

SELECT u FROM User u JOIN Group g WHERE g.groupName =: groupName
Ish
  • 3,992
  • 1
  • 17
  • 23