Bug of ordering mysql field column

Post Reply
enishemed
Posts: 653
Joined: 30 Oct 2017, 11:24
Name: Enis Hemedoglu
Location: Istanbul, Turkey
Company Name: SCORE DANISMANLIK
Contact:

Bug of ordering mysql field column

Post by enishemed »

Dear Sergey,

I have a MySQL field column called "Birim Fiyat". I want to order by ascending or descending but it is not ordering correctly. Ypu can see from the pictures. It orders as a string not as a number.

Ordering is like this.

Ascending:
10
100
125
...
750
...
90

Descending:
90
85
750
70
67,5
....
Attachments
descending.png
ascending.png
User avatar
support
Site Admin
Posts: 6231
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: Bug of ordering mysql field column

Post by support »

it's because
67,5
is string, not number.
enishemed
Posts: 653
Joined: 30 Oct 2017, 11:24
Name: Enis Hemedoglu
Location: Istanbul, Turkey
Company Name: SCORE DANISMANLIK
Contact:

Re: Bug of ordering mysql field column

Post by enishemed »

67,5 is not a string, it is because of number format. You can see the number format from the screenshot. We use dot (.) for thousand separator and comma (,) for decimal separator.
support wrote: 07 Jan 2022, 10:12 it's because
67,5
is string, not number.
Attachments
Screenshot_20220107-193550_Samsung Internet.jpg
User avatar
support
Site Admin
Posts: 6231
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: Bug of ordering mysql field column

Post by support »

Then probably for some values formula return empty string or null. Formula should return 0 or other number.
I other case mysql will think it's string and values will be ordered as string.
Can you show me your formula?
enishemed
Posts: 653
Joined: 30 Oct 2017, 11:24
Name: Enis Hemedoglu
Location: Istanbul, Turkey
Company Name: SCORE DANISMANLIK
Contact:

Re: Bug of ordering mysql field column

Post by enishemed »

I have used IFNULL function in the formula and the problem exists.
support wrote: 08 Jan 2022, 09:34 Then probably for some values formula return empty string or null. Formula should return 0 or other number.
I other case mysql will think it's string and values will be ordered as string.
Can you show me your formula?
Attachments
Screenshot_20220108-154652_Samsung Internet.jpg
enishemed
Posts: 653
Joined: 30 Oct 2017, 11:24
Name: Enis Hemedoglu
Location: Istanbul, Turkey
Company Name: SCORE DANISMANLIK
Contact:

Re: Bug of ordering mysql field column

Post by enishemed »

I have changed the formula like this and the problem solved. Thanks.

Code: Select all

IF([797]=508,IFNULL([798]+0,0),IFNULL([799]+0,0))
Post Reply