hgourvest / node-firebird

Pure javascript and asynchronous Firebird client for Node.js.
Mozilla Public License 2.0
256 stars 128 forks source link

sum error #322

Open PongraczIstvan opened 9 months ago

PongraczIstvan commented 9 months ago

Hi!

if I run the below code then I get unexpected error

const tr = await pool.getDatabase();

const sql='select fok_tetel.fok1 FOK, sum(fok_tetel.osszeg) osszeg from fok_tetel
group by fok_tetel.fok1 '; const param: any[] = []; const result = await tr.query(sql, param,true); console.log(result);

if I use min, max or avg function , then it perfect...

PongraczIstvan commented 9 months ago

if I use cast() for the osszeg field then it is all OK ...

const sql='select fok_tetel.fok1 FOK, cast(sum(fok_tetel.osszeg) as numeric(15,2)) osszeg from fok_tetel group by fok_tetel.fok1 ';

arthurprezottoandrade commented 6 months ago

Man, you have no idea how much you helped me, my sincere thanks

mreis1 commented 2 months ago

This should also work:

const sql='select fok_tetel.fok1 FOK, sum(fok_tetel.osszeg * 1.00) osszeg from fok_tetel group by fok_tetel.fok1