Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Need A Help For Sql Server 2005


  • Please log in to reply
No replies to this topic

#1 cyber_sydney_hunter

cyber_sydney_hunter

  • Members
  • 20 posts
  • OFFLINE
  •  
  • Local time:06:59 AM

Posted 22 September 2008 - 03:34 AM

why i cannot run this query

------------------------ create views ---------------------------------------------
CREATE VIEW DayWaiting AS
SELECT Name, (SELECT SUM(NbrRequested-NbrDispatched)FROM OrderItem WHERE OrderNbr = [Order].OrderNbr) as ItemOutstanding,
SUM(COALESCE(
CASE WHEN (NbrRequested-NbrDispatched) > 0 THEN
DATEDIFF(Day,OrderDate,'2008-07-16')
ELSE
Null
END))
AS DaysWaiting
FROM Customer join [Order] on Customer.CustomerID = [Order].CustomerID
join OrderItem on [Order].OrderNbr = OrderItem.OrderNbr
GROUP BY Name
GO
SELECT DayWaiting AS
SELECT Name,ItemOutstanding,DaysWaiting
--drop view DayWaiting
SELECT * FROM DayWaiting;
------------------------ end of views -------------------------------------------------



it gave me this error "Msg 102, Level 15, State 1, Procedure DayWaiting, Line 8 Incorrect syntax near ')'."

BC AdBot (Login to Remove)

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users