Hi,
I've got this query but I'm not able to find the results in the right ordering sorting by the date:
select count(*) as numero_righe
,CONVERT (varchar(10), st.CREATEDDATETIME, 103) DataOrdine
CONVERT (varchar(10), st.DELIVERYDATE, 103) DataRichiestaSpedizione
from SALESTABLE st
inner join SALESLINE sl on st.DATAAREAID = sl.DATAAREAID and st.PARTITION = sl.PARTITION and st.SALESID = sl.SALESID left join WHSLOADLINE ll on st.DATAAREAID = ll.DATAAREAID and st.PARTITION = ll.PARTITION and st.SALESID = ll.ORDERNUM
where st.DATAAREAID = '800'
and st.PARTITION = 5637144576
and sl.ITEMID not like '800%'
and sl.SALESSTATUS = 1
and ll.ORDERNUM is null
and sl.DLVMODE not like 'Drop%'
and st.SALESTYPE = 3
group by CONVERT (varchar(10), st.CREATEDDATETIME, 103) , CONVERT (varchar(10), st.DELIVERYDATE, 103)
order by DataOrdine]
numero_righe DataOrdine DataRichiestaSpedizione 2 03/06/2024 05/07/2024 1 03/06/2024 12/07/2024 5 03/06/2024 31/07/2024 1 03/07/2024 03/07/2024 57 04/07/2024 29/08/2024 49 05/07/2024 05/07/2024 32 05/07/2024 19/08/2024 1 07/05/2024 07/05/2024 11 10/07/2024 28/08/2024 526 10/07/2024 30/08/2024
As you can see the column DataOrdine is not sorted as I'm expected.
Could you help me to understand where is the error?
tks
creatinf query with dates and have sorting like described before