title: Differentiating records based on the occurence
body: <p>Below is the Sample Data</p>
  <p><a href="https://i.stack.imgur.com/w61ZM.png" rel="nofollow noreferrer">source table here</a></p>
  <p>with the above data i need to create 3 tables having data as below;</p>
  <p><a href="https://i.stack.imgur.com/ObtgH.png" rel="nofollow noreferrer">Target tables</a></p>
  <p>Even once the customer turns red, he should be in Red bucket with minimum data he went on Red.
  Orange = Target table-Red and have orange atleast once with minimum date
  Green= Target table-Red-Orange(Obviously he would be green)</p>