質問

Kohanaクエリでは、同じIDを持つ1つの要素のみを取得する必要があります。モデルにはメソッドがあります。

public function next_products_images($id)
{
  return $this->where('product_image_product', '>=', $id-5)->limit(5)->find_all();  
  //for taking the previous five product pictures       
}  

しかし、問題は、上記のすべての結果から、メソッドによって生成された場合、「Product_image_Product」が異なるもののみが必要であることです。これはKohana ormを使用して実行できますか?

どうもありがとう!

役に立ちましたか?

解決

それはaを使用して動作しますか group by?

return $this->where('product_image_product', '>=', $id-5)->limit(5)->group_by('product_image_product')->find_all();
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top