Ecto mirrors SQL quite closely so if you examine the difference between your SQL statement and your Ecto expression you can see you are missing a |> select(....) expression in your pipeline. But equally, your commented code isn’t a valid Ecto expression so I suggest you revisit the query documentation to see how to construct a query.
Well done. You could also do Repo.one if you just want a single result, not a list. However if the query returns more than one result then an exception will be raised.