# Code snippet from example.

**URL:** <https://forum.kx.com/t/code-snippet-from-example/7751>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [June 1, 2012, 7:45pm UTC](https://forum.kx.com/t/code-snippet-from-example/7751 "2012-06-01T19:45:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krishna1](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@Krishna1](https://forum.kx.com/u/Krishna1)\
**Post date:** [June 1, 2012, 7:45pm UTC](https://forum.kx.com/t/code-snippet-from-example/7751/1 "2012-06-01T19:45:00Z")

</div>

Hi All,What does the following code do?{@[;`sym;`p#]`sym xasc x}each`trade`quote;wheretrade:([]sym:n?`sym;time:09:30:00.0+til n;price:n?2.3e;size:n?9;ex:n?ex);quote:(sym:n?`sym;time:09:30:00.0+tiln;bid:n?2.3e;ask:n?2.3e;bsize:n?9;asize:n?9;ex:n?ex);Thanks,Raman

---

<div class="post-metadata">

**Author:** ![nathan\_perrem1](https://avatars.discourse-cdn.com/v4/letter/n/839c29/32.png) [@nathan\_perrem1](https://forum.kx.com/u/nathan_perrem1)\
**Post date:** [June 1, 2012, 7:47pm UTC](https://forum.kx.com/t/code-snippet-from-example/7751/2 "2012-06-01T19:47:00Z")

</div>

It sorts the 2 tables in ascending order on `sym and then applies the parted attribute to the sym column of each in memory table.
