所以我试图在我的桌子上使用 SELECT Distinct 选项
Hashlog.select("DISTINCT tag").select("created_at").order("created_at DESC").limit(10)
1.9.3-p286 :017 > Hashlog.select("DISTINCT tag").select("created_at").order("created_at DESC").limit(10)
Hashlog Load (0.7ms) SELECT DISTINCT tag, created_at FROM "hashlogs" ORDER BY created_at DESC LIMIT 10
=> [#<Hashlog tag: "new", created_at: "2012-12-11 04:06:37">,
#<Hashlog tag: "now", created_at: "2012-12-11 04:06:33">,
#<Hashlog tag: "googleold", created_at: "2012-12-11 04:06:28">,
#<Hashlog tag: "google", created_at: "2012-12-11 04:06:26">,
#<Hashlog tag: "facebook", created_at: "2012-12-11 04:06:21">,
#<Hashlog tag: "facebook", created_at: "2012-12-11 04:06:18">,
#<Hashlog tag: "faceboot", created_at: "2012-12-11 04:06:15">]
所以我希望结果只在标签列上是唯一的,但它不会让我按 created_at 排序,除非它通过选择。