表数据如下
查看用户名相同的记录
select * from user where username in (select username from user group by username...username,phone)
in (select username,phone from user group by username,phone HAVING count(*) >1);
注意:where条件中(...实际执行会报如下错误:
1093 - You can’t specify target table ‘user’ for update in FROM clause
含义:不能在同一表中查询的数据作为同一表的更新数据...相关初始化数据
CREATE TABLE `user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT...;
INSERT INTO `user`(`id`, `username`, `phone`, `age`) VALUES (1, '我是主数据库的zjq', '13666666666', 18);