There is a loop I pulled from the database with cfloop. After transferring this loop to arrays, I want to increase the number of stocks if the same array exists.
<cfoutput query="getStocks">
<cfif #CurrentRow# lt 5>
<cfscript>
c=#CurrentRow#;
if (c==1){
arr[c]['stok_kod']='#STOCK_CODE#';
arr[c]['lot']='#LOT_NO#';
arr[c]['stok']=#STOK_MIKTARI#;
arr[c]['depo']='#DEPO#';
arr[c]['isim']='#PRODUCT_NAME#';
arr[c]['skt']='#GET_SKT.DELIVER_DATE#';
}
for (i=1; i <= arrayLen(#arr#);i++) {
if (arr[i]['stok_kod'] eq '#STOCK_CODE#' ){
arr[i]['stok']+=#STOK_MIKTARI#;
}else{
arr[c]['stok_kod']='#STOCK_CODE#';
arr[c]['lot']='#LOT_NO#';
arr[c]['stok']=#STOK_MIKTARI#;
arr[c]['depo']='#DEPO#';
arr[c]['isim']='#PRODUCT_NAME#';
arr[c]['skt']='#GET_SKT.DELIVER_DATE#';
}
}
</cfscript>
</cfif>
</cfoutput>
How can I detect those with the same stock code?

You can try to use query of queries method with
GROUP BYfunctionHere is the example how it works.
OUTPUT