一、更新某列,自动递增
xhc_free_video: 表名 sort: 字段
代码语言:javascript复制set @rownum=0;
update xhc_free_video
SET sort = (
select @rownum := @rownum 1 as sort)
二、改变查询字段格式
代码语言:javascript复制cast(id as varchar)
三、三个表关联查询
代码语言:javascript复制SELECT t3.id, t3.NAME, t4.age
FROM (
SELECT t1.id, t2.NAME
FROM (
SELECT id
FROM tb_user
) t1
LEFT JOIN tb_user_copy2 t2 ON t1.id = t2.id
) t3
LEFT JOIN tb_user_copy2_copy1 t4 ON t3.id = t4.id