Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL 常用命令 #7

Open
OnedayLiu opened this issue Apr 12, 2018 · 0 comments
Open

SQL 常用命令 #7

OnedayLiu opened this issue Apr 12, 2018 · 0 comments

Comments

@OnedayLiu
Copy link
Owner

OnedayLiu commented Apr 12, 2018

查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断

select * from people  where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)  ;

查询某个字段的条数

SELECT count(*) as count FROM push_record WHERE create_time BETWEEN "2018-03-28 00:00:00" and "2018-03-28 23:59:59";

按天查询

SELECT COUNT(*) AS push_num, create_time
FROM push_record
GROUP  BY DATE_FORMAT(create_time, '%Y%m%d')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant