I have a table where the column has assign_id and assign_type. First I’m loading all the data where assign_id is 1 and then I’m doing a group_by for how many assign_type is associated with assign_id
So first I loaded all the data by this
query = from(a in Amenity,
where: a.assign == ^assign_id,
)
query
|> Repo.all()
|> Enum.group_by(fn(item) → item.assign_type end)
But it’s giving me a result like this
%{
nil: [
%Amenity{
assign_id: 1,
assign_type: "user"
}
]
}