All pastes #929014 Raw Edit

Something

public text v1 · immutable
·published 2008-03-05 13:58 UTC
rendered paste body
select cn.Number, cp.*
from ContractProduct cp (nolock)
    join Contract c (nolock) on c.ContractId = cp.ContractId
    join Customer cu (nolock) on cu.CustomerId = c.CustomerId_Owner
    join ContractProductCustomerNumber cpcn (nolock) on cpcn.ContractProductId = cp.ContractProductId
    join CustomerNumber cn (nolock) on cn.CustomerNumberId = cpcn.CustomerNumberId 
where 1 = 1
  and cp.ProductId = 12000
  and cp.DeactivationDate IS NULL
  and cp.ActivationDate > '20080101'
  and cu.CompanyId_Vendor = 200007