title: SQL - Find patterns of records
body: <p>Newbie here, so bear with me...</p>
  
  <p>Would it be possible to find patterns of records?</p>
  
  <p>I need to find repeating SEQUENCES of songs in the output of a radio programming software.</p>
  
  <p>The station manager wants to know if certain songs 'next' to certain other songs repeat over time, ie if the DJs are getting lazy and repeating certain sequences.</p>
  
  <ol>
  <li>the table is ordered by a timestamp (datetime-aired)</li>
  <li>'next' is defined as: </li>
  </ol>
  
  <p>a) contiguous (song x has a rec-no of n, song y a rec-no of n+1) or </p>
  
  <p>b) separated by one ad (song x has a rec-no of n, the ad has a rec-no of n+1, song y a rec-no of n+2)</p>
  
  <p>Can't seem to find a way to get the info I need. Any ideas?</p>