SuiteQL
SuiteScript SuiteQL Syntax
SuiteQL Syntax Basics
SuiteScript SuiteQL syntax follows SQL-92 with NetSuite tables.
Introduction to SuiteQL Syntax
SuiteQL is a query language used in NetSuite's SuiteScript to retrieve data from NetSuite records. It adheres to the SQL-92 standard, allowing developers to leverage their SQL knowledge while working within the NetSuite environment. This makes SuiteQL a powerful tool for extracting and manipulating data programmatically.
Basic SELECT Statement
The SELECT
statement in SuiteQL is used to query data from NetSuite tables. It follows the conventional SQL syntax, which is familiar to those who have used SQL before.
SELECT firstname, lastname, email FROM customer WHERE isactive = 'T'
Using WHERE Clauses
The WHERE
clause is used to filter records based on specific conditions. This allows you to retrieve only the data that meets certain criteria. SuiteQL supports a variety of operators within the WHERE clause.
SELECT id, companyname FROM customer WHERE entitystatus = '13' AND salesrep = '5'
ORDER BY and LIMIT Clauses
To sort and limit the results of your queries, you can use the ORDER BY
and LIMIT
clauses. These clauses help you organize the data and control the number of records returned.
SELECT id, companyname FROM customer ORDER BY companyname ASC LIMIT 10
Handling Joins in SuiteQL
While this guide focuses on basic SuiteQL syntax, it's important to note that SuiteQL supports complex queries with joins. You can join multiple tables to extract related data in a single query. This topic will be covered in more detail in the next part of the series.
SuiteQL
- Previous
- SuiteQL Queries
- Next
- SuiteQL Joins