Rinkashiki
22nd March 2019, 09:17
hello. there is an inquiry:
sql1 = sql.parse(
" select sum(maho):1 from ("
& " select round((tisfc010.maho/tisfc010.qpli),4) as maho "
& " from tisfc010 "
& " where tisfc010._index1 = {:3} and "
& " tisfc010.qpli <> 0 and "
& " tisfc010.cwoc like :4 & '.*' and "
& " tisfc010.cwoc not like '.*' & 'B' & '.*' "
& " ) aa"
)
sql.select.bind(sql1, 1, SUM_1)
sql.where.bind (sql1, 3, orno)
sql.where.bind (sql1, 4, mnwc_1_3)
e = sql.exec(sql1)
sql.fetch(sql1)
sql.break(sql1)
sql.close(sql1)
gives out a mistake. and it is necessary to round to summation. HELP!

Ajesh
22nd March 2019, 13:54
Have never used it like this.. Why don't you divide and then take round and then take sum individually than directly in the SQL query, like below


on case ( sql.fetch(sql) )
case eendfile:
break
case 0:
print_info(ppmod090.fld1, total)
continue
default: | error
message("Error %d occurred", db.error)
endcase
break

Rinkashiki
23rd March 2019, 06:09
it everything is clear. but when operations 200 by request, so it summarized at once everything. and so on each operation rounded, then again came. if it within all orders, long turns out. :)