query.SuiteQL

Note:

The content in this help topic pertains to SuiteScript 2.0.

Object Description

A SuiteQL query.

SuiteQL is a query language based on the SQL-92 revision of the SQL database query language. It provides advanced query capabilities you can use to access your NetSuite records and data.

Use Query.toSuiteQL() to create this object. This method converts an existing query.Query object to its corresponding SuiteQL representation as a query.SuiteQL object. You can use SuiteQL.run() to run the query and obtain the results as a query.ResultSet object. You can also use SuiteQL.runPaged(options) to run the query as a paged query and obtain the results as a query.PagedData object.

When you convert a query.Query object to a query.SuiteQL object, the resulting SuiteQL query is the same as the original query. It includes the same query result columns, sort order, and conditions that were set on the original query. When you run the resulting SuiteQL query using SuiteQL.run() or SuiteQL.runPaged(options), you receive the same results as you would if you ran the original query using Query.run() or Query.runPaged().

For more information and examples of using SuiteQL in the N/query module, see SuiteQL in the N/query Module. For more information about SuiteQL in general, see SuiteQL.

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Module

N/query Module

Methods and Properties

SuiteQL Object Members

Since

2020.1

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/query Module Script Samples.

            // Add additional code
...
// myQuery is an existing query.Query object
var mySuiteQLQuery = myQuery.toSuiteQL();

var results = mySuiteQLQuery.run();
...
// Add additional code 

          

Related Topics

N/query Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices