Error
Right now this is inefficient to do in SQL because it does a row-level lookup
```
SELECT TOP 1 p.[Id]
FROM
[Person] p
INNER JOIN [GroupMember] gm ON gm.[PersonId] = p.[Id]
INNER JOIN [GroupTypeRole] gtr ON gtr.[Id] = gm.[GroupRoleId]
WHERE
gtr.[Guid] = '2639F9A5-2AAE-4E48-A8C3-4FFE86681E42' -- adult
AND gm.[GroupId] = @UnitId
ORDER BY p.[Gender]
And queries that need a HeadofHousehold could go much faster with that Id written to a table. Doesn't have to the Group table, just any table that relates Groups and HeadofHousehold
Cultivate your ideas for maximum impact with these helpful submission tips that will increase the chances of your brilliant concepts becoming reality.