Skip to content

Where Clause TQL

We support a shortened tql statement that is referred to as a TQL Where Clause, more than just a WHERE clause is supported, ORDER BY, SKIP and LIMIT are all supported in this.

This was seen as a way to create a very simple type of query statement for when you mostly just want to limit results but don’t need to specify specific fields you want returned.

WHERE <condition>
LIMIT <integer>
SKIP <integer>
ORDER BY <attribute> <DESC | ASC>

Clauses

Clause Description
WHERE Used to extract only those records that fulfill a specified condition
ORDER BY Used to sort the result-set in ascending or descending order
SKIP Used to skip N number of records (occurs before limit)
LIMIT Used to restrict the output to only N number of records

Examples

In this example assume a transaction dictionary exists and is populated with thousands of records/assets.

Basic:

Only the documents in this collection/chain that contain an attribute called ‘num’ whose numeric value is 234 are returned. Let’s assume 200 documents are found but then we limit that to 100 documents and we also skip the first 50 and the documents are going to be sorted based on the attribute num.

WHERE num = 234
LIMIT 100
SKIP 50
ORDER BY num