Code in Book Not Working
I was told that the author of the book mentioned below recently ran this query and it worked. I don't see how:
I've been trying to run code found on page 144 of the "Professional SQL Server 2005 Programming" book for the last 2 days.
--Using AdventureWorks database
SELECT c.LastName,
ISNULL(CAST(SELECT MIN(OrderDate)
FROM Sales.SalesOrderHeader o
WHERE o.ContactID = c.ContactID)AS varchar), ' Never Ordered')
AS 'Order Date'
FROM Person.Contact c
I get the error:
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'SELECT'.
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near ')'.
I've tried modify this query to no end and can't figure out what's wrong. Please help.
Kim Avery
|