【巨杉数据库Sequoiadb】【咨询】【内置SQL】执行exec命令查询substr函数时报错-195

【问题描述】
执行命令 sdb “db.exec(‘select substr(pad,1,2) as sss,count(id) as count from sysbench_test.sbtest1 group by substr(pad,1,2)’)” 时报错,报错信息如下:
(sdbbp):1 uncaught exception: -195
SQL syntax error
【解决方法】
目前内置SQL语法并不支持此类函数,仅支持聚集相关的函数。内置SQL功能不够全面,一般推荐用SQL引擎(MySQL/PostgreSQL),但是标准SQL语句中对json的操作的支持是比较弱。因此推荐直接用原生的语法去操作。具体参考更新符 s u b s t r h t t p : / / d o c . s e q u o i a d b . c o m / c n / i n d e x c a t i d 1440656863 e d i t i o n i d 302 S Q L s u m ( ) c o u n t ( ) a v g ( ) m a x ( ) m i n ( ) f i r s t ( ) l a s t ( ) p u s h ( ) a d d t o s e t ( ) b u i l d o b j ( ) m e r g e a r r a y s e t ( ) s u b s t r S Q L S Q L M y S Q L / P o s t g r e S Q L S Q L j s o n 使 substr: http://doc.sequoiadb.com/cn/index-cat_id-1440656863-edition_id-302 【解决方法】 目前内置SQL语法仅支持sum(),count(),avg(),max(),min(),first(),last(),push(),addtoset(),buildobj(),mergearrayset()等函数,不支持substr函数。 由于内置SQL功能不够全面,一般推荐用SQL引擎(MySQL/PostgreSQL),但是标准SQL语句中对json的操作的支持是比较弱。因此推荐直接用原生的语法去操作,原生语法使用 substr命令:db.cs.cl.find({}, {a:{$include:1, $substr:[1,2]}})
具体参考更新符 $substr: http://doc.sequoiadb.com/cn/index-cat_id-1440656863-edition_id-302

猜你喜欢

转载自blog.csdn.net/Kamani_msd/article/details/93972813