Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I Have these tables

Table1: Dept
int DeptID
nvarchar2 dept_caption

values
1 Dept1
2 Dept2
3 Dept3



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
Posted
Updated 30-Mar-15 9:31am
v2
Comments
Maciej Los 30-Mar-15 15:37pm    
I do not see relationship between Request and Dept tables...
CHill60 30-Mar-15 16:55pm    
Don't worry - it's not your eyesight ;-p
Maciej Los 30-Mar-15 16:56pm    
Thank you, Caroline. I thought i'm blind ;)
CHill60 30-Mar-15 16:59pm    
:D
phil.o 30-Mar-15 17:52pm    
I think one or two tables are missing from your description.
Moreover, you should improve your question and think very carefully of what you are stating to be the result you want to get. As is, it does not really make sense.
If you want precise answers, please take time to write precise questions.

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
 
Share this answer
 
thanks
requester is foreign key with deptid fielin dept table
responsible is foreign key with deptid field in dept table
thanks
 
Share this answer
 
Comments
King Fisher 31-Mar-15 11:38am    
Update your question ,Do not use answer section .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900