use [test1_AlplaPROD2.0_Read]

SELECT
CustomerOrderNumber 
,r.CustomerReleaseNumber
, OrderState
, r.ReleaseState
, h.CreatedByEdi
,r.AdditionalInformation1 -- the info for od exists here, this will be mapped over to an email sending out saying someoen tryied to update an od release

--, *
  FROM [order].[Header] (nolock) h

  /* get the line items to link to the headers */ 
  left join
  [order].[LineItem] (nolock) l on
  l.HeaderId = h.id

  /* get the releases to link to the headers */ 
  left join
  [order].[Release] (nolock) r on
  r.LineItemId = l.id

  where 
  --h.CreatedByEdi = 1 
  r.ReleaseState >= 1 
  --and  CustomerOrderNumber in ( '2358392')