Strange mysql date problem

Post your Gambas programming questions here.
Post Reply
bill-lancaster
Posts: 195
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

Strange mysql date problem

Post by bill-lancaster »

ORDER BY date seems not to be working.

Code: Select all

  hResult = hConn.Find("transactions", "ORDER BY TransDate")
produces:-
  • 27/01/0022 00:00:00
    27/01/0022 00:00:00
    31/01/0022 00:00:00
    31/01/0022 00:00:00
    01/12/2021 00:00:00
    01/12/2021 00:00:00
    01/12/2021 00:00:00
    01/12/2021 00:00:00
    01/12/2021 00:00:00
    01/12/2021 00:00:00
    01/12/2021 00:00:00
    01/12/2021 00:00:00
The first four records are out of sequence, the remainder are all correct.

The first four records are the most recent addition to the database so perhaps something has changed in Gambas3 or in mysql
Gambas v3.18.2
mysql Ver 8.0.33-0ubuntu0.22.04.2

This is a worrying failure of a basic function so any ideas would be appreciated.
User avatar
gbWilly
Posts: 68
Joined: Friday 23rd September 2016 11:41am
Location: Netherlands
Contact:

Re: Strange mysql date problem

Post by gbWilly »

bill-lancaster wrote: Thursday 18th May 2023 12:16pm
produces:-
  • 27/01/0022 00:00:00
    27/01/0022 00:00:00
    31/01/0022 00:00:00
    31/01/0022 00:00:00
    01/12/2021 00:00:00
    01/12/2021 00:00:00
    01/12/2021 00:00:00
    01/12/2021 00:00:00
    01/12/2021 00:00:00
    01/12/2021 00:00:00
    01/12/2021 00:00:00
    01/12/2021 00:00:00
The first four records are out of sequence, the remainder are all correct.
I see a correct order as the year 22 is way before 2021.
I guess you wanted the year 2022 instead of 22, but put in the wrong year. ;)
gbWilly
- Dutch translation for Gambas3
- Gambas wiki content contributer


... there is always a Catch if things go wrong!
bill-lancaster
Posts: 195
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

Re: Strange mysql date problem

Post by bill-lancaster »

Thank you gbWilly, panic over. I think a visit to the opticians might be in order!
Post Reply