Вопросы и ответы для программистов
select * from posthistory where comment = '1' and posthistorytypeid=10 and (select closeddate from posts where id=posthistory.postid) is not null order by creationdate