mat*_*isb 4 cql cassandra cqlsh
我有一个TABLE这样的:
id | expected | current
------+----------+--------
123 | 25 | 15
234 | 26 | 26
345 | 37 | 37
Run Code Online (Sandbox Code Playgroud)
现在我想选择所有等于 的ids地方。在 SQL 中我会做这样的事情:currentexpected
SELECT id FROM myTable WHERE current = expected;
Run Code Online (Sandbox Code Playgroud)
但在CQL中似乎无效。我的cqlsh回报是这样的:
no viable alternative at input 'current'
Run Code Online (Sandbox Code Playgroud)
是否有有效的 CQL 查询来实现此目的?
根据 CQL-Docs编辑, 它应该可以工作,但不能...这就是文档所说的:
<selectWhereClause> ::= <relation> ( "AND" <relation> )*
| <term> "IN" "(" <term> ( "," <term> )* ")"
<relation> ::= <term> <relationOperator> <term>
<relationOperator> ::= "=" | "<" | ">" | "<=" | ">="
<term> ::= "KEY"
| <identifier>
| <stringLiteral>
| <integer>
| <float>
| <uuid>
;
Run Code Online (Sandbox Code Playgroud)
我使用了错误的文档。我正在使用 CQL3 并阅读 CQL2 的文档。正确的文档说:
<where-clause> ::= <relation> ( AND <relation> )*
<relation> ::= <identifier> <op> <term>
| '(' <identifier> (',' <identifier>)* ')' <op> '(' <term> (',' <term>)* ')'
| <identifier> IN '(' ( <term> ( ',' <term>)* )? ')'
| TOKEN '(' <identifier> ( ',' <identifer>)* ')' <op> <term>
Run Code Online (Sandbox Code Playgroud)
所以这不是一个有效的查询。
| 归档时间: |
|
| 查看次数: |
1474 次 |
| 最近记录: |