2
我有两个表。复杂的SQL语句
表A - >帖子(ID,标题,USER_ID,...,created_at,..)
和
tableB的 - >转播(ID,POST_ID,USER_ID, ... created_at,...)
所以,在我的Rails应用程序控制器:
@posts = Post.find(:all, :conditions => ["user_id = ? OR id IN (select post_id from reposts where user_id=?)", '1', '1'], :limit => 9)
它工作正常,但:
我需要到ORDER BY我@posts一个组合的两列 “created_at”
任何帮助(表职位和表转播的created_at的created_at)?
我来试试吧!谢谢! – Lamp 2010-12-15 20:32:15