update pw_memberdata
set support=(select count(*) from pw_posts.tid 
where uid=pw_threads.authorid and uid<>pw_posts.authorid from pw_memberdata,pw_posts,pw_threads)

解决方案 »

  1.   

    参考
    http://topic.csdn.net/u/20071224/14/2d81e27b-a3e7-40e0-b4cf-680d9da068ee.html
      

  2.   

    select   count(*)   from   pw_posts.tid   
    where   uid=pw_threads.authorid   and   uid <> pw_posts.authorid   from   pw_memberdata,pw_posts,pw_threads
    ==================================================
    这里pw_posts是表名吗?如果是,应该是
    SELECT COUNT(*) FROM pw_posts where uid = (select uid from pw_posts,pw_memberdata,pw_threads where uid=pw_threads.authorid   and   uid <> pw_posts.authorid)
    不过好象也没涉及到表pw_memberdata
      

  3.   

    表结构是这样
    PW_MEMBERDATA     列uid,support,
    PW_THREADS       uid,authorid
    PW_POSTS     uid,tid,authorid
      

  4.   

    更新pw_memberdata.support的值,为pw_posts.tid的行数和,条件是pw_memberdata.uid=pw_threads.authorid,同时pw_memberdata.uid不等于pw_posts.authorid
      

  5.   

    这样才是对的,我指的是语法,你的语法不对,不应该有2个fromupdate   pw_memberdata 
    set   support=(select   count(*)   from   pw_posts.tid   
    where   uid=pw_threads.authorid   and   uid <> pw_posts.authorid  )
      

  6.   

    update   pw_memberdata
    set   support=(select   count(*)   from   pw_posts.tid  
    where   uid=pw_threads.authorid   and   uid <> pw_posts.authorid   from   pw_memberdata,pw_posts,pw_threads)
      

  7.   

    update pw_memberdata set support= -- 要用下面的值更新pw_memberdata.support
    (
    select count(*) -- 要计算计数
    from pw_posts.tid  -- ? from 后面的不能是字段,应该是table/view 
    where uid=pw_threads.authorid   -- 下面两行是筛选条件逻辑
    and   uid <> pw_posts.authorid   
    from   pw_memberdata,pw_posts,pw_threads -- 又一次from ? 是否应该放到括号外面,再加一些条件?
    )