我是ruby的新手,我无法将给定的查询转换为ruby查询,任何人都可以帮助我
"SELECT * FROM domainurls WHERE domaindetail_id = ?",@domain.id ,"and count IN (SELECT Max( count ) FROM domainurls WHERE domaindetail_id =?",@domain.id")"
答案 0 :(得分:0)
这是一种方法:
Domainurl.
where(:domaindetail_id => @domain.id).
where("count IN (SELECT MAX(count) FROM domainurls WHERE domaindetail_id = ? ", @domain.id)