Skip to content

Instantly share code, notes, and snippets.

@moogle19
Created June 29, 2020 19:21
Show Gist options
  • Save moogle19/4d17f14a36eb7eb69228d67160fec37b to your computer and use it in GitHub Desktop.
Save moogle19/4d17f14a36eb7eb69228d67160fec37b to your computer and use it in GitHub Desktop.
from(
v in Fnord,
select: [:id],
where: v.id in [9026, 9025, 9024, 9021, 9020, 9019],
join: t in fragment("select * from unnest('{9026, 9025, 9024, 9021, 9020, 9019}'::int[]) WITH ORDINALITY t(id, ord)"),
on: t.id == v.id,
order_by: t.ord
) |> Repo.all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment