Bounti
Hello.
I have a schema/table which contains the following field types:
name : string
has_activated : bool
is_online : bool
How would I return the different permutations of the boolean values with each count and give a name to this pair?
I thought about using group_by on both columns with count and I think I could receive the following:
True, True, 10
False, False, 15
True, False, 20
How could I give a name to each pair? For example:
{
online_and_activated: 10,
not_online_not_activated: 15,
not_online_and_activated: 20
}
Would I use something like select: %{} with | to change a value? I would need to use each group and make a new name for it with the resulting count.
Additionally, if I did this, would it also be possible return each row for each of those groups? Or should I just return every row with the addition of the summarized data above and do that part in the view/template with Elixir?
Thanks!
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming









