Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trycf/ec15de763a208878c76ff1f6dc9bff8e to your computer and use it in GitHub Desktop.
Save trycf/ec15de763a208878c76ff1f6dc9bff8e to your computer and use it in GitHub Desktop.
TryCF Gist
<cfset users = queryNew("id, firstname", "integer, varchar", [
{"id":1, "firstname":"Han"},
{"id":2, "firstname":"Han"},
{"id":3, "firstname":"James"}
])>
<cfset writeDump(users)>
<cfquery name="u1" dbtype="query">
select firstname name from users
group by name
</cfquery>
<cfset writeDump(u1)>
<cfquery name="u2" dbtype="query">
select firstname name from users
group by firstname
</cfquery>
<cfset writeDump(u2)>
<cftry>
<cfquery name="u1" dbtype="query">
select u1.firstname name
from users u1, users u2
where u1.firstname=u2.firstname
group by name
</cfquery>
<cfset writeDump(u1)>
<cfcatch><cfoutput>#cfcatch#</cfoutput></cfcatch>
</cftry>
<cftry>
<cfquery name="u2" dbtype="query">
select u1.firstname name
from users u1, users u2
where u1.firstname=u2.firstname
group by firstname
</cfquery>
<cfset writeDump(u2)>
<cfcatch><cfoutput>#cfcatch#</cfoutput></cfcatch>
</cftry>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment