Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trycf/cde74ebad21d7da070fdc10b18451c4a to your computer and use it in GitHub Desktop.
Save trycf/cde74ebad21d7da070fdc10b18451c4a to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
// Original in-memory query
employees = queryNew(
"id,name,dept,salary",
"CF_SQL_INTEGER,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_INTEGER",
[
{ id: 1, name: "Alice", dept: "IT", salary: 50000 },
{ id: 2, name: "Bob", dept: "HR", salary: 45000 },
{ id: 3, name: "Carol", dept: "IT", salary: 52000 },
{ id: 4, name: "Dan", dept: "Finance", salary: 47000 }
]
);
// Query of Query: Filter only IT department
itEmployees = queryExecute(
"SELECT * FROM employees WHERE dept = 'IT'",
[],
{ dbtype = "query"}
);
// Output the filtered result
writeDump(itEmployees);
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment