June 20, 2013 at 6:24 am
Dear all,
I have following tables
TABLE : A
ENTERPRISE_MAIN_CODE ENTERPRISE_SUB_CODE ENTERPRISE_DESCRIPTION
1 0 A
2 0 B
3 0 C
4 0 D
5 0 E
6 0 F
7 0 G
8 0 H
9 0 I
TABLE : B
ID_NO ENTERPRISE_MAIN_CODE ENTERPRISE_SUB_CODE
1 1 1
2 1 2
3 7 1
4 4 1
5 4 1
6 6 1
7 6 5
TABLE : C
ID_NO ENTERPRISE_ID_NO ENTERPRISE_DATE ENTERPRISE_AMT
1 1 20130109 1000
1 2 20130315 2000
2 3 20120120 3000
2 4 20120305 4000
3 5 20141111 5000
4 6 20130115 6000
5 7 20130320 7000
the expected op is as follows. op is based on the year 201303.
ENTERPRISE_DESCRIPTION count amt count amt count amt count amt
A 1 2000 1 4000 2 3000 2 7000
B 0 0 0 0 0 0 0 0
C 0 0 0 0 0 0 0 0
D 1 7000 0 0 2 13000 0 0
E 0 0 0 0 0 0 0 0
F 0 0 0 0 0 0 0 0
G 0 0 0 0 0 0 0 0
H 0 0 0 0 0 0 0 0
I 0 0 0 0 0 0 0 0
Thanks
Nick
June 20, 2013 at 7:08 am
Happy to help, but we don't like to do homework, tests, or work work for you. Make an attempt.
You haven't really explained how the data should be joined, or given any DDL/DML to help us set up a scenario. Most importantly, you didn't make any query attempt to get this to work yourself.
June 20, 2013 at 7:10 am
Duplicate post. Please direct all the replies here
http://www.sqlservercentral.com/Forums/Topic1465520-391-1.aspx
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply