mysql的SQL语句转换为KDB+的SQL语句

mysql里一条包含分组,排序,取前n条的sql语句如下


select create_time,price,sum(num) num from t1 WHERE sid="a" AND rid="b" GROUP BY price ORDER BY price ASC,create_time ASC LIMIT 10

在KDB+里的写法如下


select [10] from `price xasc {select num:sum num by price from t1 where sid=(x 0),rid=(x 1)}(`$"a";`$"b")



[10]对应的是LIMIT 10

`price xasc 对应的是 ORDER BY price ASC

num:sum num对应的是sum(num) num

by price 对应的是ORDER BY ASC


上一篇:代理模式


下一篇:centos7安装redmine3,并升级redmine1.8到3