一个比较奇怪的问题 表里面有一堆数据,某个字段的属性不是唯一的。比如说student表no sex0 F1 M2 F3 F4 M如何通过查询语句把sex这个域的单一的数量找出来,在这个表里面是2。谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select count(distinct sex) from student表 mysql> select * from student;+------+------+| no | sex |+------+------+| 0 | F || 1 | M || 2 | F || 3 | F || 4 | M |+------+------+5 rows in set (0.00 sec)mysql> select count(distinct sex) from student;+---------------------+| count(distinct sex) |+---------------------+| 2 |+---------------------+1 row in set (0.00 sec) select count(*) from (select distinct sex from student) t 小弟 跪求高手!怎么将两个sql语句和一起 既查出起始-中转-到达城市的信息也查出起始-到达城市的信息 hibernate中select语法count(*)时候null的问题 高手进来解决下mysql查询语句的编辑问题 MySQL表数据超过1千万,数据表经常无缘无故损坏 表连接问题 mysql存储过程[动态sql] 一个 表的设计问题,请指点 哪位兄才能够提供mysql正式版的下载地址啊,谢! 如何将outlook收到的信件信息通过php程序写入Mysql数据库 mysql中时间间隔数据统计问题! 如何用一个命令删除Mysql里面的多个数据表 新手求助,SQL查询语句后面的条件递增问题
+------+------+
| no | sex |
+------+------+
| 0 | F |
| 1 | M |
| 2 | F |
| 3 | F |
| 4 | M |
+------+------+
5 rows in set (0.00 sec)
mysql> select count(distinct sex) from student;
+---------------------+
| count(distinct sex) |
+---------------------+
| 2 |
+---------------------+
1 row in set (0.00 sec)