The Query-of-Queries (QoQ) feature of ColdFusion is especially useful for manipulating data that ColdFusion holds in a Query object but isn't actually a result set from a SQL query. For instance, LDAP results, directory lists, and FTP directory lists are all returned as Query objects by <cfldap>, <cfdirectory>, and <cfftp>.
That said, don't forget that QoQ supports the LIKE conditional for pulling the records you want. But you can search for more than 'StartOfPhrase%' when using LIKE.
I have an app that calls an LDAP query and then uses QoQ to find all User IDs (cn's) that start with "W" or "G". Why didn't I just make this filter in the LDAP call? With effort, I could have, but I was already filtering on different requirements in LDAP, and it was easier at this point to fine-tune the results with a QoQ. Previously, my code looked something like this:
SELECT * FROM LdapResults WHERE cn LIKE 'W%' OR cn LIKE 'G%'
Whereas that worked, it is needlessly verbose; this became more clear when I also had to check for IDs starting with "A", and I realized how uncomely that approach was. It also doesn't enforce the fact that the legit IDs will always be 6 characters in length.
So start using LIKE's other accepted symbols! Brackets [] let you specify a range of acceptable characters, and underscore _ lets you define how many characters to look for, versus the wildcard % which just accepts any length of characters.
SELECT * FROM LdapResults WHERE cn LIKE '[WAG]_____'
That query is more accurate and actually shorter (note: syntax highlighting makes the underscores difficult to see).
Finally, what if the first character should always be a "W", "A", or "G", but the remaining 5 characters should always be digits? The QoQ LIKE doesn't support repetition quantifiers like the curly braces {} do in RegEx. So you will have to manually repeat [0-9] for each character:
SELECT * FROM LdapResults
WHERE cn LIKE '[WAG][0-9][0-9][0-9][0-9][0-9]'
That does start getting more verbose again, but the SQL is now very precise regarding its filter requirements. A little tweaking like this, and QoQ can be extremely handy.