I have following table
Company Product Rec_Company
ABC 101 NY
EFG TX
HIG 202 TX
ABC 101 CA
ABC 101 NY
EFG NY
HIJ 202 CA
ABC 101 FL
I want following result
Company Product Rec_Company Rec_Count Product Rec_Company Count
ABC 101 NY 2 NULL FL 1
EFG
HIG
Let's take the result of first row
Company ABC used product 101, and receive company was NY, and product was used 2 times, also ABC company has NULL product and recive company was FL, and so on with EFG and HIG company
Notice that result in one row.
Thanks in Advance
For better viewing see notepad attachment