Created
September 19, 2018 17:54
-
-
Save mmrobins/14f814da9c3f7e4d22cbbd94ae4b6668 to your computer and use it in GitHub Desktop.
first passport data issue query in ecto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias Db.Salesforce.{FieldMapping, Organization, SObjectType} | |
alias Db.Repo | |
import Ecto.Query | |
mappings = | |
from( | |
[fm, o, t, f, af] in FieldMapping.joined_query(), | |
where: t.name == "lead", | |
select: [af.name, t.name, o.code, fragment("group_concat(?)", f.field)], | |
group_by: [af.name, t.name, o.code], | |
having: count("*") > 1 | |
) \ | |
|> Repo.all() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment