日期:2014-05-17  浏览次数:20898 次

写了N年SQL,被这个SQL难住了
table students结构如下:
sex qty
男 20
男 20
女 20
男 20
男 20

要用一个select语句(不要有子查询),不能用goup by
得到总人数(40)

说明:students只有2种数据:男 20;女 20,再没有其他数据,只是有重复

------解决方案--------------------
up
探讨

SQL code
with students as
(
select '男' sex ,20 qty from dual
union all
select '男' sex ,20 qty from dual
union all
select '女' sex ,20 qty from dual
union all
sel……