在行和列中使用字段 [英] use field in row and column

查看:110
本文介绍了在行和列中使用字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有这些桌子



表1:部门

Hi I Have these tables

Table1: Dept

int DeptID
nvarchar2 dept_caption






values

1 Dept1
2 Dept2
3 Dept3







表2:请求




Table2: Request

int RequestID
int Requester
int Responsible




RequestID   1   2  3 4 5 6 7
Requester   1   2  1 3 3 3 4
Responsible 2   3  2 1 3 1 4





如何显示每位负责人的请求数?



How can I show count of request for every responsible?

 req\responaible      Dept1   Dept2   Dept3   ...
Dept1                 2        14       5
Dept2                 3        22        4
Dept3                 4        3        2 







best rgds




best rgds

推荐答案

可以此格式出现



我的数据是:



Req_Department || Responsible_dept



Department1 ||部门1

部门1 || Department4

Department2 || Department2

Department3 ||部门1

部门2 || Department3

Department3 ||部门1

部门4 ||部门3



如何从数据中获得此资产



向负责部门索取req / res请求数





Req_Dept / Resp_dept ||部门1部门2部门3部门4 ....



部门1 || 1 0 0 1

Department2 || 0 1 1 0

Department3 || 2 0 0 0

Department4 || 0 0 1 0













best rgds
can present in this form

My data is:

Req_Department || Responsible_dept

Department1 || Department1
Department1 || Department4
Department2 || Department2
Department3 || Department1
Department2 || Department3
Department3 || Department1
Department4 || Department3

How can I get this resualt from data

count of req/res request to responsible department


Req_Dept/ Resp_dept|| Department1 Department2 Department3 Department4 ....

Department1 || 1 0 0 1
Department2 || 0 1 1 0
Department3 || 2 0 0 0
Department4 || 0 0 1 0
.
.
.
.


best rgds


谢谢

请求者是deptid fielin dept table的外键

负责是dept表中deptid字段的外键

谢谢
thanks
requester is foreign key with deptid fielin dept table
responsible is foreign key with deptid field in dept table
thanks


这篇关于在行和列中使用字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆