Created
August 3, 2023 08:17
-
-
Save trycf/10d1b31b3a5aa54851a91f0b9df6bfd4 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 qExpEmp = QueryNew("payrollyear, amounta, xhour, xday, aprice, clientnr", | |
"Integer,Decimal,Decimal,Integer,Decimal,varchar")> | |
<cfscript> | |
queryAddRow(qExpEmp); | |
querySetCell(qExpEmp,"payrollyear","2022"); | |
querySetCell(qExpEmp,"amounta","-216.81"); | |
querySetCell(qExpEmp,"xhour","-8.25"); | |
querySetCell(qExpEmp,"xday","1"); | |
querySetCell(qExpEmp,"aprice","26.2800"); | |
querySetCell(qExpEmp,"clientnr",nullValue()); | |
queryAddRow(qExpEmp); | |
querySetCell(qExpEmp,"payrollyear","2022"); | |
querySetCell(qExpEmp,"amounta","-216.81"); | |
querySetCell(qExpEmp,"xhour","-8.25"); | |
querySetCell(qExpEmp,"xday","1"); | |
querySetCell(qExpEmp,"aprice","26.2800"); | |
querySetCell(qExpEmp,"clientnr",6); | |
</cfscript> | |
<cftry> | |
<Cfquery name="q" dbtype="query"> | |
SELECT payrollyear, | |
sum(amounta) as amounts, | |
sum(xhour) as vhour, | |
sum(xday) as vday, | |
sum(aprice) as totprice, | |
IFNULL(clientnr,''), count(*) as rows | |
FROM qExpEmp | |
WHERE payrollyear = '2022' | |
AND IFNULL(clientnr,5) = '5' | |
group by payrollyear, price, clientnr | |
</Cfquery> | |
<cfdump var=#q#> | |
<cfcatch><cfoutput>#cfcatch#</cfoutput></cfcatch> | |
</cftry> | |
<cftry> | |
<Cfquery name="q" dbtype="query"> | |
SELECT payrollyear | |
FROM qExpEmp | |
WHERE payrollyear = '2022' | |
</Cfquery> | |
<cfdump var=#q#> | |
<cfcatch><cfoutput>#cfcatch#</cfoutput></cfcatch> | |
</cftry> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment