Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MacBook-Pro:m32 xbsd$ ./q
- KDB+ 3.1 2013.09.05 Copyright (C) 1993-2013 Kx Systems
- m32/ 4()core 16384MB xbsd macbook-pro.local 192.168.1.2 PLAY 2013.12.04
- q)n:5000000
- q)sym:`a`b`c`d`e`f`g`h`i`j`k`l`m`n`o`p`q`r`s`t
- q)t:([]col1:n?1000;col2:n?1000; col3:n?1000; grp:n?sym)
- q)s:sym
- q)\t exec s#(grp!col4) by col1:col1,col2:col2 from update col4:sum col3 by col1,col2,grp from t
- 11865
- q)select[10] from exec s#(grp!col4) by col1:col1,col2:col2 from update col4:sum col3 by col1,col2,grp from t
- col1 col2| a b c d e f g h i j k l m n o p ..
- ---------| ------------------------------------------------------------------..
- 0 0 | 662 977 ..
- 0 1 | 881 16 313 1544 943 291 623 ..
- 0 2 | 336 ..
- 0 3 | 533 674 1637 658 ..
- 0 4 | 1362 338 178 322 ..
- 0 5 | 557 758 84 936 ..
- 0 6 | 776 519 1516 287 ..
- 0 7 | 906 239 293 ..
- 0 8 | 829 19 ..
- 0 9 | 663 551 814 ..
- q)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement