Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
SQL
@CategoryID
select
(SELECT dbo.udf_GetQtyOnHand(invID)) QtyOnHand,tblInventoryMaster.*,tblUnitMaster.*,tblNonStockDetails.*
from tblNonStockDetails
left outer join tblInventoryMaster on tblNonStockDetails.nsdInventoryID=tblInventoryMaster.invID
left outer join tblUnitMaster on tblInventoryMaster.invBaseUnitID=tblUnitMaster.unID
where tblInventoryMaster.invCategoryID in (select * from tblInventoryCategory where invcatNodeID=@CategoryID 
order by ISNULL (NULLIF(invcatParentNodeID,0),invcatNodeID),invcatParentNodeID,invcatNodeID)
and tblNonStockDetails.nsdDocType='MR1'
end 

I am getting this error.
"The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified."

How to do modifications in this query. the order by condition is according to tree view.
Posted
Updated 23-Feb-13 21:48pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900