----补全用户名,向前补全
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
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
解决方案 »
- 求把TXT的数据导入MYSQL的方法
- 安装bugzilla时连接mysql的问题
- mysql 中写sql语句咱和mssql不一样的?
- 请问mysql如何给字母数字混合的字段排序?
- mysql 怎样分组查询?(答案有用者给分)
- mysql分表问题
- 求update多条件更新语句
- select top n
- Hibernate用sql查询mysql的char类型字段问题
- 无法启动MySQL: The server quit without updating PID file
- 自增无意义主键的表中,select ... for update语句怎样才能做到行级锁?
- 使用mariadb-c连接器连接数据库,如何判读server是否离线?
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这里不能这样写
建议看下楼上的建议