如果要查每个相同的名字分别有多少个
select name,count(*) from table group by nameset names gbk # windows 下一定要加上。cmd命令行中,如果在文件中改为utf8drop table if exists user
CREATE TABLE `user` (
`id` int(11) unsigned NOT NULL auto_increment,
`txt` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
insert into user (txt) values ('张三'),('小张'),('张'),('李'),('李四'),('小李')
select * from user where txt like '张%'
select * from user where txt like '李%'
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)