I have one stored procedure which has multiple queries in there. #Temp1 has all of the records within a date range.
#Temp2 has only the specific criteria of records within a date range and comes from #Temp1.
What I am trying to do is show some totals at the end of my report showing the percentage of documents in #Temp2 divided by the number of documents in #Temp1.
Select cDocNum
, cOrigin
, cDestin
, cCust
, dDueDate
, dShipDate
, cDocType
From #Temp1
Order By cOrigin, cDestin, cCust, cDocNum
Select cDocNum
, cOrigin
, cDestin
, cCust
, dDueDate
, dShipDate
, cDocType
From #Temp2
Order By cOrigin, cDestin, cCust, cDocNum