2
有了這個實體卡桑德拉CQL where子句括號
@Table(keyspace = KEYSPACE)
public class CE_TimeSeries extends Entity implements TimeSeriesPoint{
@PartitionKey(1)
private String typeId;
@ClusteringColumn(value=1, asc=true)
private String userId;
@ClusteringColumn(value=2, asc=true)
private Date startDate;
@Column
private Date endDate;
@Column
private int groupInterval;
@Column
private int interval;
}
這CQL
SELECT startDate, endDate, groupInterval, interval FROM CE_TimeSeries WHERE typeId
= :typeId and userId = :userId and (endDate >= :fromDate or (startDate >=
:fromDate and startDate <= :toDate))
給異常:
Caused by: com.datastax.driver.core.exceptions.SyntaxError: line 1:142
mismatched input 'or' expecting ')' (... (endDate >= :fromDate [or] (...)
沒有OR怎麼辦? –
@NassimMOUALEK構建不依賴於它的使用的查詢模型。 – Aaron