I have a table that has a salesman number in one column, Sold By, and a 'Taken For' salesman number in another for a sale. I want to group and sum sales by the salesman's number in either the Sold By column or the Taken For column.
An example is:
Sale Sold By Taken For
$20 B A
Results in Salesman A getting a total of $30 while salesman B only gets the sales from the one he did on his own.
I'm new to this kind of SQL, I mostly used simple statements to pull data, this is the first time I'm trying to do the heavy lifting in the SQL server instead of having the end program, Crystal Reports, Access, etc doing it.