0
我將此查詢集中在一起,表現良好。嘗試使用rails執行連接表時發生輕微查詢問題2.3.5
search = Artist.where(:status => "active").where("upcoming_events_count > 0").order("echonest_external_popularity DESC").limit(limit))
問題是我想添加一個檢查,這是在另一個表ArtistPhoto上。比賽需要確保藝術家(來自artist_id)也包含有效的照片。
我有查詢工作獨立發現:
ArtistPhoto.where("artist_id = ? and artist_photos.primary = ?", self.id, true).first
如果任何人都可以得到連接成1個查詢將是巨大的幫助。
感謝
工作完美。正是我需要的,謝謝Pinny! – stonep