ColdFusion 9 SELECT IN query using ormExecuteQuery()

For some reason this took me some effort to figure out. Maybe others will find it useful.

<cfscript>
CategoryList = '1,2,3';
Categories = ormExecuteQuery("from Category where Id IN (:IdList)",{IdList=ListToArray(CategoryList)});
</cfscript>

If you know a better way please drop me a comment. I posted this in the Adobe Coldfusion forum for a few days but didn’t get anything.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.