您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

mysql >查询语句_MySQL

2024/3/3 12:19:14发布14次查看
bitscn.com
mysql >查询语句
* 查询多条不重复记录
  id name
  1 a
  2 b
  3 c
  4 c
  5 b
select id, name from s1 group by name
1 a
2 b
3 c
5 b
* 查询重复记录最多的记录
select keyword, count( * ) as count  
from article_keyword  
group by keyword  
order by count desc  
limit 20
* 查询重复记录和重复次数
select user_name,count(*) as count from user_table group by user_name having count>1;
* 多联查询
s1表
id name
3    a
s2表
id s1_id age 
1   2     12
2   3     23
select * from `s2` where `s1_id` = (select id from `s1` where `name` = 'a');
结果 
2   3     23
bitscn.com
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product