易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关问答:

总会碰到怪的问题,sql问题

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  ......

sql 问题

DateTime startTime=DateTime(em_1.Text)
DateTime endTime=DateTime(em_2.Text)

string sql
sql = dw_1.GetSQLSelect()+"Where (StartTime> '"+startTime+"') and (EndTime ......

求一个sql 语句

  table1
  名称      入库数
  CT机        3   
  CT机        5
  X光机      4 ......

access 中执行sql语句update不成功,求助!!!

access 中执行sql update语句时有时候成功有时候不成功,但是access中不出错误信息,不知道是什么原因,有哪位大侠知道,请帮忙啊
贴SQL语句,检查表、字段的有效性设置

sql 在查询分析器里面 执行很正常

是 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号