Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sum error #322

Open
PongraczIstvan opened this issue Dec 29, 2023 · 3 comments
Open

sum error #322

PongraczIstvan opened this issue Dec 29, 2023 · 3 comments

Comments

@PongraczIstvan
Copy link

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
Copy link
Author

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
Copy link

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

@mreis1
Copy link

mreis1 commented Jul 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants