Skip to content

yudy-chen/votes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Votes

This is the example of how to query the "count" of a field from other table on Elixir Ecto

''' votes_count = Repo.all(from issue in Issue, as: :issue, left_lateral_join: vote in subquery(from v in Vote, where: [issue_id: parent_as(:issue).id], group_by: [v.issue_id, v.is_agree], select: %{ count: count("*"), is_agree: v.is_agree } ), select: %{ issue_id: issue.id, count: vote.count, is_agree: vote.is_agree, issue_description: issue.description } ) |> map_count_result()

'''

To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.setup
  • Install Node.js dependencies with npm install inside the assets directory
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Learn more

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published