Loading TOC...


   select as String,
   [qualifier as String]
) as ModifyPlan


This function dynamically constructs a row set based on a SQL SELECT query from views.

select A SQL SELECT query expressed as a string.
qualifier Specifies a name for qualifying the column names. Placeholder parameters in the SQL string may be bound in the result() call.

Usage Notes

The fromSQL function is one of the Data Access Functions.


// List all of the employees in the 'employees' view.

const op = require('/MarkLogic/optic');

  op.fromSQL('SELECT employees.FirstName, employees.LastName FROM employees')


// Joins the row set produced by a SQL SELECT with the row set produced by a
// SPARQL SELECT and then groups, orders, and limits the result:

const op = require('/MarkLogic/optic');

const topTweeters =
  op.fromSQL('SELECT customerId, customerName FROM customers WHERE ...', 'customers')
      op.fromSPARQL('SELECT ?customerId ?tweetId WHERE { ... }', 'tweets'),
        op.viewCol('customers', 'customerId'),
        op.viewCol('tweets',    'customerId')
    .groupBy('customerName', op.count('tweetCount', 'tweetId'))
    .map(row => {...})

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.