title: Apply argMax over multiple columns in Clickhouse
body: <p>My Clickhouse table has a primary key column (<code>pk</code>), an insert timestamp column (<code>insert_ts</code>), and a bunch of data columns. I'd like to get the latest value for each data column. My query could look like this:</p>
  <pre><code>SELECT pk, argMax(data1, insert_ts), argMax(data2, insert_ts), ... GROUP BY pk
  </code></pre>
  <p>That's very verbose, and I'd prefer to use a wildcard with EXCEPT/APPLY like this:</p>
  <pre><code>SELECT * EXCEPT(insert_ts) APPLY(argMax) GROUP BY pk
  </code></pre>
  <p>But I have no way to specify the second argument to <code>argMax</code>. Any ideas?</p>
  <p>I'm interested both in answers to this specific question, and also to answers to the XY-problem that propose a different way to structure my table.</p>