Created
September 1, 2023 12:29
-
-
Save trycf/ec15de763a208878c76ff1f6dc9bff8e to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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