I'm using this Query but I have it wrong...
SELECT * FROM [Orders]
JOIN [Customers]
ON [Orders].[CustomerID] = [Customers].[CustomerID]
WHERE [Orders].[OrderDate] BETWEEN '2010/1/1' AND '2011/1/1'
AND [Orders].[Total] > 1
I'm getting a Duplicate Column name error for CustomerID. I'm not sure how to use an Alias for this to work.
Could someone show me how to write it correctly.
EDIT:
Thanks for all the suggestions, here's what I can out with.
SELECT DISTINCT Orders.CustomerID, Orders.ShipToID, Orders.ShipName, Orders.ShipAddress, Orders.ShipAddress2, Orders.ShipCity, Orders.ShipStateOrProvince, Orders.ShipPostalCode, Orders.Total, Orders.OrderDate, Customers.Profession
FROM Orders
JOIN Customers
ON Orders.CustomerID = Customers.CustomerID
WHERE Orders.OrderDate BETWEEN '4/3/2010' AND '2/20/2011'
AND Orders.Total > 1
Thanks Again!
SELECT *in production code; name your columns. Please read sqlblog.org/blogs/aaron_bertrand/archive/2009/10/10/…SELECT *still helps alleviate the issue - at least then you have control over aliases.'yyyy/m/d'- I have an article for that too: sqlblog.org/blogs/aaron_bertrand/archive/2009/10/16/…