Subquries and jsonb


been learning elixir on the job and i ahave this query that gets business id from an applications table then mathces it to business_id of the same application but want to limit editing
the subquery seems to fail on iex.

from(a in App.Models.Application, where: fragment("? @> {“business_id”:?}", a.form_data, business_id) and a.status == “review”, limit: 1) |>

** (Ecto.Query.CompileError) variable business_id is not a valid query expression. Variables need to be explicitly interpolated in queries with ^
(ecto) expanding macro: Ecto.Query.where/3
iex:10: (file)
(ecto) expanding macro: Ecto.Query.limit/3
iex:10: (file)
(ecto) expanding macro: Ecto.Query.from/2
iex:10: (file)
(elixir) expanding macro: Kernel.|>/2
iex:10: (file)


Try using ^business_id instead of just business_id, as external variables must be interpolated with ^ in Ecto queries (as the error states).