ALTER TABLE test
ADD COLUMN new_column varchar(255) CHARACTER SET utf8 NULL DEFAULT '' COMMENT '测试添加新的字段' AFTER name,
CHANGE COLUMN old_name new_name varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '测试修改字段名' AFTER id,
MODIFY COLUMN apply_url varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '测试修改varchar长度' AFTER url
登录日志,根据uid获取最新时间的每个用户一条记录
select GROUP_CONCAT(id order by time desc) from table1 where uid in(304,318,303,302) group by uid
select SUBSTRING_INDEX(GROUP_CONCAT(id order by time desc), ',', 1) from table1 where uid in(304,318,303,302) group by uid
select * from table1 where id in(select SUBSTRING_INDEX(GROUP_CONCAT(id order by temi desc), ',', 1) from table1 where uid in(304,318,303,302) group by uid) ORDER BY FIELD(uid,304,318,303,302)
select FROM_UNIXTIME(a.lastactivity, '%Y-%m-%d %H:%i:%s') as LogDATE from pre_common_member_status a where a.uid in(
17,
490
)
ORDER BY FIELD(uid,
17,
490
);#时间格式化输出;按照固定uid顺序排序