I wasn't able to find out or figure out but the page here http://help.exacttarget.com/en/documentation/exacttarget/content/ampscript/ampscript_syntax_guide/data_extension_ampscript_functions/#LookupOrderedRows suggests that we can create an AND clause within lookupOrderedRows. (Be awesome to create filters like that on the fly!) I don't see any directions on how. What we wish to do is filter the results first by a matched GUID code and then by a datestamp.

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

Does this need the word AND within the script or something else to make sense of the formula?

  • So it appears the script was ok, but adding parameters with comparison operators other than "=" will require a Filter so this won't do what I'd hoped in this instance. Still useful in many other ways as indicated in answers below.
    – Jonny Shaw
    Commented May 28, 2014 at 19:03

2 Answers 2


To build an AND clause, you just keep adding parameters. Note you can only do a look up against EQUALS, not greater than like in your example. If you need to do that, you should use ExecuteFilter with a DataFilter

So, it would be something like:

LookupOrderedRows("Cars",4, "name1", @val1,"name2", @val2,"name3", @val3)

The values are only compared with =.

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

This would only return those whos StartDate are equal to Now().

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .