You cannot directly join a stored procedure. You can join the temporary table that this stored procedure populates:
- create a temporary table
- run an SP that populates the data in your temporary table,
- join the temp table in your query,
- temp table temp.
Of course, this is not one linear solution.
In another way (worse, in my opinion), I think it is to have as many UDFs as there are columns in the SP result set, it may look like pluggable code:
SELECT Ticket.TicketID as `Ticket`, Ticket.DtCheckOut as `Checkout Date / Time`, CONCAT(Customer.FirstName, ' ', Customer.LastName) as `Full Name`, Customer.PrimaryPhone as `Phone`, Ticket_FiscalTotals_Service(Ticket.TicketID) as `Service`, Ticket_FiscalTotals_Items(Ticket.TicketID) as `Items`, Ticket_FiscalTotals_SalesTax(Ticket.TicketID) as `SalesTax`, Ticket_FiscalTotals_eTaxAmount(Ticket.TicketID) as `eTaxAmount`, Ticket_FiscalTotals_GrandTotal(Ticket.TicketID) as `GrandTotal` FROM Ticket INNER JOIN Customer ON Ticket.CustomerID = Customer.CustomerID ORDER BY Ticket.SiteHomeLocation, Ticket.TicketID
source share