It can first be converted into a matrix, then calling avg
will compute the average for each column of the matrix. Finally, group and aggregate by stock code, combined with toArray
to get the desired result.
select toArray(avg(matrix(BidPrice))) from t where date(DateTime) =2023.11.01 group by SecurityID