create or replace view v_Forums_Forums as
  select c.id as categoryid,c.name as categoryname,c.imageurl as categoryimageurl,
     c.position as categoryposition,c.description as categorydescription,
     f.id as forumid,f.name as forumname,f.imageurl as forumimageurl,
     f.position as forumposition,f.description as forumdescription,
     (select count(*) from forums_topics t 
         where t.forumid=f.id) as ForumTopicsCount,
     (select count(*) from forums_topics t 
         where t.forumid=f.id) 
         +
         (select count(*) from forums_replies r 
         where r.forumid=f.id) as ForumPostsCount,
         
     (select adddate from (select forumid,adddate from forums_topics
         union all
         select forumid,adddate from forums_replies) as dates
                                                   --as去掉试试
           where dates.forumid=forums_forums.id) as ForumLastPostDate 
                             --forums_forums换成f试试
      
     from forums_categories c,forums_forums f 
    where c.id=f.categoryid