留言与评论(共有 0 条评论) |
发布时间:2020-04-15 16:56:17
mysql只用一条sql语句查出一个表里不同条件对应的数据条数的步骤如下: 我们需要准备的材料分别是:电脑、sql查询器。
1、首先,打开sql查询器,连接上相应的数据库表,例如stu2表。
2、点击“查询”按钮,输入: select count(*) from stu2 where sex=1 and age=2 union all select count(*) from stu2 where sex=1 and age=5 union all select count(*) from stu2 where sex=1 and age=10
3、点击“运行”按钮,此时能只通过一条sql高效查询结果。
留言与评论(共有 0 条评论) |
全站搜索