LookupOrderedRows

Overview

Returns a specified number of rows. You can specify multiple additional field and value pairs as part of an AND clause. The function returns an empty set when no values match.

Syntax

LookupOrderedRows(1, 2, 3, 4, 5)

Function Properties

Ordinal Type Description
1 string Required Name of data extension from which to return specified rows
2 numeric Required Number of rows to return. A value less than 1 returns the default 2000 rows. This limitation enhances script performance.
3 string Required Defines order of return as field ASC or field DESC
4 string Required Field to use to build WHERE clause
5 string Required Value to use to build WHERE clause

Usage

Set @rows2 = LookupOrderedRows("Cars",4,"Horsepower Desc","MPG",Field(@cardata,"MPG"))

This call returns the 4 rows from the Cars data extension with the highest horsepower that match the value specified by MPG.

Last Updated: Jun 8, 2021