SELECT enr.sc, enr.pr,ENR.ID, ENR.ED, ENR.LD, enr.er, enr_1.sc,enr_1.pr, ENR_1.ED AS Expr1, ENR_1.LD AS Expr2, enr_1.er FROM ENR INNER JOIN ENR AS ENR_1 ON ENR.ID = ENR_1.ID AND ENR.YR = ENR_1.YR WHERE (ENR.DEL = 0) AND (ENR_1.DEL = 0) AND enr.ed > enr_1.ed AND (enr.ed <= enr_1.ld OR enr_1.ld IS NULL) and enr.yr = '20' + SUBSTRING(db_name(),4,2) ORDER BY ENR.ED
Finding overlapping ENR records using SQL Print
Modified on: Thu, Feb 9, 2017 at 9:45 AM
  
  
    	
    
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
         
         
         
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
  
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
         Previous Article: Combining multiple rows into one row or variable
      
    
      
    
      
         
      
    
      
    
      
    
      
    
      
    
      
         Next Article: Determining a student's graduation year using SQL
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
      
  
  
Did you find it helpful? Yes No
Send feedbackSorry we couldn't be helpful. Help us improve this article with your feedback.