I am using SQL 2008. (in asp actually).
SELECT orderId, CONVERT(varchar, orderDate, 101) AS Date_Ordered, CONVERT(varchar, sentDate, 101) AS Date_Shipped,
FROM orders
GROUP BY orderId, CONVERT(varchar, o.orderDate, 101), CONVERT(varchar, o.sentDate, 101)
ORDER BY Date_Shipped
OK, The reason I am using the Convert in the Select is because my Data has Dates with different times. but I want all results with the same Day. So I used the convert.
My problem is that I can not figure out how to do the Order By.
I tried sorting by Date_Shipped, but its now a String so it does not sort properly.
Can anyone help?
You have SQL Server 2008 so you can use the date type
I can’t recall exactly if this is allowed but hopefully you get the idea: if not, use this