新手问题 rails 数据库查询问题

76521 · 2013年06月14日 · 最后由 76521 回复于 2013年06月24日 · 2608 次阅读

ef self.find_all_by_tag_type(tag_type) find(:all,:conditions=>['tag_type =?',tag_type ] , :distinct=>tag_type) end 比如这个方法我要查询除去重复的 tag_type 这个字段的 所有数据 那地方那个条件该怎么写啊?

self.group(:tage_type)

find(:all, :select => "DISTINCT tag_type")
需要 登录 后方可回复, 如果你还没有账号请 注册新账号