這似乎是世界上最簡單的事情,但我想獲得一個整數從外生查詢返回: iex(10)> num = Polo.Repo.all(from n in Polo.Account.Number, select: max(n.account))
[debug] QUERY OK source="account_numbers" db=3.0ms queue=0.1ms
SELECT max(a0."acco
我想選擇一個記錄(整個記錄),其中名稱是xxx,品牌是xxx。該記錄將永遠是奇異的,因爲名稱和品牌是唯一索引: def getProductByNameAndBrand(name, brand) do
IO.puts("getProductByNameAndBrand")
IO.inspect(name)
IO.inspect(brand)
from p i
在我的鳳凰的應用程序,我有以下模式: defmodule TattooBackend.Accounts.Account do
schema "accounts" do
field :email, :string
field :crypted_password, :string
field :password, :string, virtual: true
我有這個工作查詢: products_shops_categories = from p in Product,
join: ps in ProductShop, on: p.id == ps.p_id,
join: s in Shop, on: s.id == ps.s_id,
join: pc in ProductCategory, on: p.id == pc.