DataFaucet ORM

Subqueries

A subquery is a method of filtering data in a statement when a join isn't an option (delete and update statements don't allow joins). Fortunately this is easy to do with DataFaucet, you just create select object and use that as the content argument for your filter.

Example:

<cfscript>
  // get the datasource
  ds = request.DataFaucet.getDatasource(); 
  // get the id of all forums in the conference to delete 
  stmt = ds.getSelect("forumid","tblForum"); 
  stmt.filter("conferenceid",form.conferenceid); 
  
  // delete all messages from the affected forums 
  ds.getDelete("tblForumMessage").filter("forumid",stmt,"IN").execute(); 
</cfscript>