SQL order by a column from another table

Viewed 45713

I have 3 tables: people, groups and memberships. Memberships is a join table between people and groups, and have 3 columns: personId, groupId and description (text).

I want to select entries from the memberships table depending on a groupId but sorting the result by the names of people associated to the found memberships (name is a column of people table)

SELECT * FROM "memberships" WHERE ("memberships".groupId = 32) ORDER BY (?????)

Is it possible to achieve this in one single query?

3 Answers
Related