'Can't convert from date time to varchar
This is my question I am trying to solve:
Create a report that the CompanyName and total number of orders by customer renamed as number of orders since December 31, 1996. Show number of Orders greater than 10
and I am using northwind database.
And my problem is that I can't convert datetime to varchar.
select c.CompanyName,
count(o.OrderID) as NumOrders,
convert(varchar(255),o.OrderDate)
from Customers c
join Orders o on(c.CustomerID = o.CustomerID)
where o.OrderDate >= '1996-12-31 00:00:00.000'
group by c.CompanyName,o.OrderDate
having count(o.OrderID) > 10
order by NumOrders desc;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
