I am trying to retreive a description for a code from a code table where the code or the key could come from one of two different tables. When I attempt to do it I get an error "Subquery returned more than 1 value." Here is the code I am using.
When dbo.tarInvoice.ReasonCodeKey is null Then
Join dbo.tsoSalesOrder ON
dbo.tsoSalesOrder.UserFld3 = dbo.tciReasonCode.ReasonCodeID AND dbo.tsoSalesOrder.CompanyID =dbo.tciReasonCode.CompanyID)
JOIN dbo.tarInvoice ON dbo.tarInvoice.ReasonCodeKey = dbo.tciReasonCode.ReasonCodeKey)
End as OrderType,