I have a 3 tables,
1.Payment Collector
- Product
- Payment
Payment collectors are collecting payments product wise and stored into payment table. products are assigned to payment collectors some products are not assign to collectors.. question is how to retrieve all the payment collectors product wise total collected amount result should be,
Note: data should be retrieve horizontal way and vertical way (two queries)
Thanks.
Best Answer
This is a long one, but it should work for you, accomplishing what you want.
The Setup
Query 1 - Horizontal
Query 2 - Vertical (using Pivot)