I’m facing an issue with returning data with sorting on Laravel.
I would like to sort the data by the created date and order it by the Job number simultaneously.
I have tried setting this up in the SQL, but the result is not what I want.
The data is as follows:
taskid | Createtime | JobNo |
---|---|---|
101337 | 3/7/2024 12:21:21 PM | 23120099AN |
101338 | 3/7/2024 12:25:47 PM | 23120099AN |
101353 | 3/7/2024 4:58:48 PM | 23110245IR |
101363 | 3/7/2024 8:25:57 PM | 23120095AN |
101364 | 3/7/2024 8:29:51 PM | 23110245IR |
101365 | 3/7/2024 8:30:22 PM | 23110245IR |
101369 | 4/7/2024 12:46:25 AM | 23120777AN |
101371 | 4/7/2024 12:47:21 AM | 23120777AN |
101372 | 4/7/2024 12:47:59 AM | 23120099AN |
101373 | 4/7/2024 12:49:06 AM | 23120099AN |
And the result I want is:
taskid | Createtime | JobNo |
---|---|---|
101337 | 3/7/2024 12:21:21 PM | 23120099AN |
101338 | 3/7/2024 12:25:47 PM | 23120099AN |
101372 | 4/7/2024 12:47:59 AM | 23120099AN |
101373 | 4/7/2024 12:49:06 AM | 23120099AN |
101353 | 3/7/2024 4:58:48 PM | 23110245IR |
101364 | 3/7/2024 8:29:51 PM | 23110245IR |
101365 | 3/7/2024 8:30:22 PM | 23110245IR |
101363 | 3/7/2024 8:25:57 PM | 23120095AN |
101369 | 4/7/2024 12:46:25 AM | 23120777AN |
101371 | 4/7/2024 12:47:21 AM | 23120777AN |
Could you please help me understand how I can achieve the desired sorting, where the data is first ordered by the Createtime (ASC) and sorting by the JobNo as same time?