xmysql icon indicating copy to clipboard operation
xmysql copied to clipboard

aggregate return wrong value

Open gianfabiopezzolla opened this issue 5 years ago • 0 comments

Please provide dev environment versions of your system

node -v v14.0.0

npm -v 6.14.4 mysql --version 8.0.19 MySQL Community Server xmysql --version

{
  "mysql": "8.0.19",
  "node": "14.0.0"
}

I made a simple get to retrive the latest order in database so my get is:

http://localhost:4003/api/BFP_ordini/aggregate?_fields=id_ordine

but xmysql return me the wrong max_of_order_id key

[
  {
    "min_of_id_ordine": "0",
    "max_of_id_ordine": "99999",
    "avg_of_id_ordine": 3027.4137931034484,
    "sum_of_id_ordine": 702360,
    "stddev_of_id_ordine": 17104.231478148486,
    "variance_of_id_ordine": 292554734.45808554
  }
]

it return me "max_of_id_ordine": "99999"

but in the db the real max_of_id_ordine is "100000"

infact if i made a get with this parameter:

http://localhost:4003/api/BFP_ordini?_where=(id_ordine,eq,100000)

xmysql return me the correct order:

[
  {
    "id_ordine": "100000",
    ...
  },
  {
    "id_ordine": "100000",
    ...
  }
]

How is possible?


gianfabiopezzolla avatar Jun 01 '20 14:06 gianfabiopezzolla