联合查询 举例:
select (select COUNT(id) from emailcontent where state=1 and hasRead=0) as a,
(select COUNT(id) from emailcontent where state=1 and hasRead=1) as b,
(select COUNT(id) from emailcontent where state=1 and hasRead=2) as c
结果集: [{a=0, b=31, c=0}]
一条select语句实现多条查询语句

本文介绍了一种使用单条SELECT语句实现多条件查询的方法。通过示例展示了如何统计不同状态和阅读情况的邮件数量,包括未读、已读和特定状态下的邮件数目。
4万+

被折叠的 条评论
为什么被折叠?



