def dashboard_params(param) do
"Transactions"
|> join(
:right,
[c],
day in fragment("""
SELECT CAST(DATEADD(DAY, nbr - 1, DATEADD(month, DATEDIFF(month, 0, CAST(CURRENT_TIMESTAMP AS DATETIME)), 0)) AS DATE) d
FROM (
SELECT ROW_NUMBER() OVER (ORDER BY c.object_id) AS Nbr
FROM sys.columns c
) nbrs
WHERE nbr - 1 <= DATEDIFF(DAY, DATEADD(month, DATEDIFF(month, 0, CAST(CURRENT_TIMESTAMP AS DATETIME)), 0), EOMONTH(CAST(CURRENT_TIMESTAMP AS DATETIME)))
"""),
day.d == fragment("CAST(? AS DATE)", c.inserted_at)
)
|> group_by([c, day], [day.d, c.voucher_provider])
|> order_by([_c, day], day.d)
|> select([c, day], %{
day: fragment("convert(varchar, ?, 107)", day.d),
count: count(c.id),
status: c.voucher_provider
})
|> Repo.all()
end
βtransactionsβ is the name of the tableβ¦
the code above is one i want to query how many days are in a mouth based on the first of the month to-day β¦ but i sim to get an error on |> joinβ¦saying no function clause mathcing ecto.query.join/5. what is the best way i can achieve this