Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. **BranchId GroupCode Cash Credit**
  2. 1000 AA 10 8644
  3. 1000 AA 12 1244
  4. 1000 BB 20 7535
  5. 1000 CC 30 5633
  6. 1001 AA 50 5763
  7. 1001 AA 34 2343
  8. 1001 BB 60 1000
  9. 1001 BB 62 2346
  10. 1002 BB 34 1600
  11. 1002 CC 68 1700
  12.  
  13. **BranchId | AA_Cash | AA_Credit | BB_Cash | BB_Credit | CC_Cash | CC_Credit**
  14. 1000 ?
  15. 1001
  16. 1002
  17.  
  18. select * from
  19. (select bid, GroupCode, Cash FROM dueList) as T
  20. PIVOT (sum(Cash) for GroupCode in([AA_Cash],[BB_Cash],[CC_Cash])) PT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement