fund表
ID accountid 支出资金 收入资金
1 10 99.1 null
2 11 99.1 null
3 12 null 80fund表
accountid accountnum
10 中国银行
11 人民银行
12 现金
... ...显示的效果
ID accountid 支出资金 收入资金 中国银行 人民银行 现金 ......
1 10 99.1 null 1 0 0 .....
2 11 99.1 null 0 1 0 ......
3 12 null 80 0 0 1 ......
.... 有2个表,一个是 account, fund, accountid是关联的/
我要显示的效果是 accountnum 字段横这排。
现金,中国银行,其他 等等。 下面的 0和1 的意思就是 fund.accountid =account.accountid 就显示问1, 不等于就显示为 0。
解决方案 »
- 关于aspx网页的问题,急求,谢谢
- 读取数据库,生成个js文件,请高手指点?
- __dopostback 回发调用repeater的 itemcommand 事件
- NET调试程序
- 问几个简单的问题,在后台如何取页面上的Rado和CheckBox的值?
- 怎样才能看到一个文件的编码格式(如ascii,gb2312,utf等)
- 控件显示顺序问题
- 两页面传值(页数),大家帮看看,我感觉正常的路子好象走不通
- asp.net中treeview怎么实现不刷新?没有autopostback这个属性!
- 急切求 最新版本的 Rational Rose ,好心的兄弟,大姐,妹子,给俺发一个吧,我的msn:[email protected]
- sql 问题
- ASP.NET如何用Response.Write 生成pdf文件,
select cy_item.cy_size as 项目规格,cy_item.cy_tsyq as 特殊要求,cy_item.cy_num as 冲印数量, isnull(cy_h_num,0) as 回单数量, isnull(cy_f_num,0) as 返工数量,isnull(cy_zk_num,0) as 重开数量 from cy_item left join h_item on cy_item.cy_custdo_id=h_item.cy_custdo_id and cy_item.cy_size=h_item.cy_size and cy_item.xh=h_item.xh left join f_item on cy_item.cy_custdo_id=f_item.cy_custdo_id and cy_item.cy_size=f_item.cy_size and cy_item.xh=f_item.xh left join zk_item on cy_item.cy_custdo_id=zk_item.cy_custdo_id and cy_item.cy_size=zk_item.cy_size and cy_item.xh=zk_item.xh where cy_item.cy_custdo_id='" & GridView1.Rows(e.NewSelectedIndex).Cells(1).Text & "'"
SELECT account.*,
(SELECT COUNT(*)
FROM fund, account
WHERE fund.accountid = account.accountid) AS 中国银行,
(SELECT COUNT(*)
FROM fund, account
WHERE fund.accountid = account.accountid) AS 人民银行,
(SELECT COUNT(*)
FROM fund, account
WHERE fund.accountid = account.accountid) AS 现金
FROM fund account
select
account.id, account.accountid, account.支出资金, account.收入资金,
(case accountnum when '中国银行' then 1 else 0 end) as 中国银行,
(case accountnum when '人民银行' then 1 else 0 end) as 人民银行,
(case accountnum when '现金' then 1 else 0 end) as 现金
from
account inner join fund
on
account.accountid = fund.accountid
1 10 99.1000 NULL 1 0 0
2 11 99.1000 NULL 0 1 0
3 12 NULL 80.0000 0 0 1