hello,
(I am using MySQL) There i use SUM a lot of times.. so..
1.- the mysql engine is calculating each time the value of these
or
2.- use a cached value
is the answer is the 1st, is there any way more efficient than doin this query ??


sSQL = "SELECT "
sSQL = sSQL & "cue_id as 'Nro Cuenta', "
sSQL = sSQL & "cue_descripcion as 'Descripcion Cuenta', "
sSQL = sSQL & "SUM(IFNULL(asidet_debe,0)) as 'Debe', "
sSQL = sSQL & "SUM(IFNULL(asidet_haber,0)) as 'Haber', "
sSQL = sSQL & "IF(SUM(IFNULL(asidet_debe,0)) - SUM(IFNULL(asidet_haber,0)) > 0,SUM(IFNULL(asidet_debe,0)) - SUM(IFNULL(asidet_haber,0)),0) as 'Saldo Deudor', "
sSQL = sSQL & "IF(SUM(IFNULL(asidet_debe,0)) - SUM(IFNULL(asidet_haber,0)) < 0,SUM(IFNULL(asidet_haber,0)) - SUM(IFNULL(asidet_debe,0)),0) as 'Saldo Acreedor' "
sSQL = sSQL & "FROM "
sSQL = sSQL & "contab_cuentas_mayor LEFT JOIN contab_asientos_detalle "
sSQL = sSQL & "ON asidet_cue_id = cue_id "
sSQL = sSQL & "GROUP BY cue_id"


thanks in advance,
Ricardo