sql统计语句
在access数据库,做个统计。能不能用条sql语句做?例子如下。
性别 民族
女 汉
女 回
男 满
男 汉
做个统计:
民族/性别 男 女
汉 1 1
回 0 1
满 1 0
遇见张三李四····················
行转列················
SQL code:
declare @TT table
(
性别 char(2),
民族 char(10)
)
insert into @TT select '女','汉'
union all select '女','回'
union all select '男','满'
union all select '男','汉'
select 民族,
sum(case when 性别='女' then 1 else 0 end) '女',
sum(case when 性别='男' then 1 else 0 end) '男'
from @TT group by 民族
SQL code:
declare @TT table
(
性别 char(2),
民族 char(10)
)
insert into @TT select '女','汉'
union all select '女','回'
union all select '男','满'
union all select '男','汉'
select 民族,
sum(case when 性别='男' then 1 el
相关问答:
sql2005
select *from v_ddxx where d_sfsc='0' and (g_ssbm='1001' or g_ssbm='1002') and (xxf>0 and xxfwzf <>0 ),执行速度慢的要死,但是如果把(xxf>0 and ......
DateTime startTime=DateTime(em_1.Text)
DateTime endTime=DateTime(em_2.Text)
string sql
sql = dw_1.GetSQLSelect()+"Where (StartTime> '"+startTime+"') and (EndTime ......
table1
名称 入库数
CT机 3
CT机 5
X光机 4 ......
access 中执行sql update语句时有时候成功有时候不成功,但是access中不出错误信息,不知道是什么原因,有哪位大侠知道,请帮忙啊
贴SQL语句,检查表、字段的有效性设置
sql 在查询分析器里面 执行很正常
是 ......