How to write select query using simple query?

The query that I want to run using java is

select TransactionId from `AccountsT` use keys "101"

I am using Statement and do not know how to add the ‘use keys’ to the statement.
Is the following statement correct?

Statement statement = select("TransactionId").from(i("AccountsT")).add("use keys 101");

Hi @shreyagoel0911

There are methods that you can also chain to include USE KEYS to your statements; an example is below:

Statement statement = select("TransactionId").from(i("AccountsT")).useKeysValues("101");

That should produce the desired statement.

You can see more examples in the Java SDK Tests here.


1 Like

Note for such a simple query you could just use the Sub-Document API - see:


Thank you! This one worked just fine for me!!

I wasn’t aware of this method. I will try it! Thank you :slight_smile: