Don't do straight division in SQL like that if TotalOuts is
ever returning Zero, you are going to get a division by Zero Error.
If Data Integrity isnt crucial, you can massage the data by
using a CASE statement for Zero to turn any into a 1 when SUMing
the values.
Otherwise, Run this Query:
<cfquery name="getSubYear" datasource="Cricket">
SELECT
SUM(BatHowOut <> 'Not Out') AS TotalOuts,
SUM(BatHowOut = 'Caught') AS Caught,
SUM(BatHowOut = 'LBW') AS LBW,
SUM(BatHowOut = 'Bowled') AS Bowled,
SUM(BatHowOut = 'Stumped') AS Stumped
FROM
BattingStats AA
</cfquery>
<!--- Then Check for Zero Values in a Query of Queries:
--->
<cfset checkIntegrity = getYear()>
<cfif checkIntegrity.TotalOuts NEQ 0>
<cfquery name="getYear" dbtype="query">
SELECT
(Caught / TotalOuts) AS CaughtPer,
(LBW / TotalOuts) AS LBWPer,
(Bowled / TotalOuts) AS BowledPer,
(Stumped / TotalOuts) AS StumpedPer
FROM
getSubYear
</cfquery>
<cfelse>
Custom Error Message
</cfif>