根据当前日期查询有多少人过生日
select * from people p where substr(p.idcard,11,2) = DATE_FORMAT(NOW(),'%m');
查询price一样的人数
select * from people where price in (select price from people group by price having count(*)>1);
上面这段sql的性能有很大的局限性
select price from people group by price having count(*)>1
上面这段代码的意思是以price为一组,结果大于1的price
全文完,感谢您的耐心阅读~
欢迎大家关注我的公众号