----补全用户名,向前补全
update a set a.user_name = (select b.user_name from td.bi_app_pagevisit b where b.client_session_id = a.client_session_id and b.visit_date >= a.visit_date and b.user_name is not null order by b.visit_date limit 1)
from td.bi_app_pagevisit a
where a.user_name is null

解决方案 »

  1.   

    建议楼主下载参考一下MYSQL官方免费手册中的语法说明。然后尝试亲自修改,如果有语法错误则MYSQL会有提醒。
      

  2.   

    UPDATE [LOW_PRIORITY] [IGNORE] tbl_name
        SET col_name1=expr1 [, col_name2=expr2 ...]
        [WHERE where_definition]
        [ORDER BY ...]
        [LIMIT row_count]
    所以from td.bi_app_pagevisit a
    where a.user_name is null这里不能这样写
    建议看下楼上的建议