I need some guidance in modifying a SQL query.
There are 2 tables (Orders & OrdersArchived) with the same column names. I understand that usig the AS to alias the name is how to deal with the duplicate names, but I can't work out how to incorporate this into a query that already uses aliases to pick up the hours from a date.
My original query is:
sSQL = "SELECT DATEPART(Hour, orderDate) AS [OrderHour], COUNT(*) AS [sCount]
FROM Orders
WHERE CAST(orderDate AS DATE) Between '"&sStartDate&"' And '"&sEndDate&"'
GROUP BY DATEPART(Hour, orderDate) ORDER BY OrderHour"
and this works fine from the Orders table but I cant expand it to work from the 2 tables.