【发布时间】:2010-03-19 14:56:53
【问题描述】:
“select * from users, Awards where (users.id = Awards.user_id) and Awards.trophy_id not in (select Awards.trophy_id from Awards where Awards.trophy_id = #{trophy.id})”
【问题讨论】:
-
这是做什么的?命名范围用于单个模型;你想获得用户还是奖励?此外,内部 select 语句看起来总是只返回
trophy.id。
标签: sql ruby-on-rails ruby named-scope