Ci4 orderBy Float Value |
Hi All,
I have a little problem with sort values (Float type) from database mysql. I use -> orderBy("FieldFloat","desc"), But incorrect result, Please helpme (08-22-2021, 07:27 AM)hieuhiti Wrote: Hi All, Check your datatype. or you can try PHP Code: $builder->select('(FieldFloat * 1) AS FieldFloat, Field2');
Please read this:
MySQL - B.3.4.8 Problems with Floating-Point Values Your problem may be a MySQL problem with floats. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Thanks for everyone's help,
I tried: $this->orderBy('CAST(FieldFloat as DECIMAL(10,5))','DESC',FALSE); and got the desired result. |
Welcome Guest, Not a member yet? Register Sign In |