title: kdb update column and perform a sort based on group and then update another column based on date rank
body: <p>I have a table below eg,</p>
  <ol>
  <li>how do I sort date in asc order and for those sorted date we want expiration_date to be sorted in asc order.</li>
  <li>once we do that we want to add symbology to sym column,
  so nearest expiry date will be denoted ESc1! and then second nearest will be ESc2!</li>
  <li>we should rollover to the next contract on expiry date - 1, so the day before expiration we will change ESc2! will change to ESc1!</li>
  </ol>
  <pre><code>  date      sym   expiration_date
  2021-11-01  ES1!  2021-12-17
  2021-11-01  ES2!  2022-03-18
  2021-11-01  ES3!  2022-06-17
  2021-11-02  ES1!  2021-12-17
  2021-11-02  ES2!  2022-03-18
  2021-11-02  ES3!  2022-06-17
  2021-11-03  ES1!  2021-12-17
  2021-11-03  ES2!  2022-03-18
  2021-11-03  ES3!  2022-06-17
  2021-11-12  ES1!  2021-12-17
  2021-11-12  ES2!  2022-03-18
  2021-11-12  ES3!  2022-12-16
  2021-11-12  ES4!  2022-06-17
  2021-11-15  ES1!  2021-12-17
  2021-11-15  ES2!  2022-03-18
  2021-11-16  ES1!  2021-12-17
  2021-11-16  ES2!  2022-03-18
  2021-11-16  ES3!  2022-06-17
  </code></pre>
  <p>Expected Output</p>
  <pre><code>  date      sym   expiration_date
  2021-11-01  ES1!  2021-12-17
  2021-11-01  ES2!  2022-03-18
  2021-11-01  ES3!  2022-06-17
  2021-11-01  ESc1!  2021-12-17
  2021-11-01  ESc2!  2022-03-18
  2021-11-01  ESc3!  2022-06-17
  2021-11-02  ES1!  2021-12-17
  2021-11-02  ES2!  2022-03-18
  2021-11-02  ES3!  2022-06-17
  2021-11-02  ESc1!  2021-12-17
  2021-11-02  ESc2!  2022-03-18
  2021-11-02  ESc3!  2022-06-17
  2021-11-03  ES1!  2021-12-17
  2021-11-03  ES2!  2022-03-18
  2021-11-03  ES3!  2022-06-17
  2021-11-03  ESc1!  2021-12-17
  2021-11-03  ESc2!  2022-03-18
  2021-11-03  ESc3!  2022-06-17
  2021-11-12  ES1!  2021-12-17
  2021-11-12  ES2!  2022-03-18
  2021-11-12  ES3!  2022-12-16
  2021-11-12  ES4!  2022-06-17
  2021-11-12  ESc1!  2021-12-17
  2021-11-12  ESc2!  2022-03-18
  2021-11-12  ESc3!  2022-06-17
  2021-11-12  ESc4!  2022-12-16
  2021-11-15  ES1!  2021-12-17
  2021-11-15  ES2!  2022-03-18
  2021-11-15  ESc1!  2021-12-17
  2021-11-15  ESc2!  2022-03-18
  2021-11-16  ES1!  2021-12-17
  2021-11-16  ES2!  2022-03-18
  2021-11-16  ES3!  2022-06-17
  2021-11-16  ESc1!  2021-12-17
  2021-11-16  ESc2!  2022-03-18
  2021-11-16  ESc3!  2022-06-17
  </code></pre>