MySQL query fields are not sorted correctly

Post Reply
Edition Nehemia
Posts: 59
Joined: 18 Feb 2023, 16:44
Name: Christoph Berger
Location: Steffisburg, Switzerland

MySQL query fields are not sorted correctly

Post by Edition Nehemia »

Hi Sergey,

MySQL query fields are not sorted correctly in tables if they are only numbers.
Apparently a text sort is applied, which makes perfect sense. It would be worth checking whether it is not possible to specify in the field options whether this is a pure number. This would then allow the correct sorting to be applied to each field.

I have included it under errors because it is a number field and the numbers are not sorted correctly at the moment.

Kind regards
Christoph
Didou12
Posts: 487
Joined: 14 Jan 2023, 14:53
Name: Louis
Location: Montreal, Canada

Re: MySQL query fields are not sorted correctly

Post by Didou12 »

Like : 0, 1, 10, 11, 2, 3 ?
Using Rukovoditel since 2022 --- v3.4 (with extension) in French on PHP 8.2
I keep the French translation up to date
I'm trying to help you (+10 years experience in html, css, php, sql, JS/jquery, python)
Edition Nehemia
Posts: 59
Joined: 18 Feb 2023, 16:44
Name: Christoph Berger
Location: Steffisburg, Switzerland

Re: MySQL query fields are not sorted correctly

Post by Edition Nehemia »

Yes, exactly!
Is there a solution?
User avatar
support
Site Admin
Posts: 6222
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: MySQL query fields are not sorted correctly

Post by support »

Open phpmyadmin and change column type to Float to this field, if this field contain only numbers.
By default this filed type is string that is why it sorts as string.

So find table app_entity_X (X - is ID of entity)
And in table find column field_Y (Y - is ID of your field)

Backup first before any changes in db.
Edition Nehemia
Posts: 59
Joined: 18 Feb 2023, 16:44
Name: Christoph Berger
Location: Steffisburg, Switzerland

Re: MySQL query fields are not sorted correctly

Post by Edition Nehemia »

THANK YOU, works perfectly!
Post Reply