See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.
SELECT P.ID, Title, PageType, CASE WHEN P.ParentID is NULL Then 0 ELSE P.ParentID END as ParentID, Live, Hidden, ISNull(Entries,0) Entries, ISNull(GrandParent,0)GrandParent FROM MyPage P left join(select P2.ParentID, COUNT(P2.ID) Entries from dbo.MyPage P2 Group By P2.ParentID) P2 on P2.ParentID = P.ID left join(select P3.ID, COUNT(P3.ParentID) GrandParent from dbo.MyPage P3 Group By P3.ID) P3 on P3.ID = P.ParentID Where COALESCE(P.ParentID, 0) NOT IN (Select ID from dbo.MyPage where PageType = 3) ORDER BY CASE WHEN COALESCE(GrandParent,0) = 0 THEN P.ParentID ELSE GrandParent END, CASE WHEN COALESCE(P.ParentID, 0) = 0 THEN P.ID ELSE P.ParentID END, ID
left join(select P3.ID, COUNT(P3.ParentID) GrandParent from dbo.MyPage P3 Group By P3.ID) P3 on P3.ID = P.ParentID
|indexed table vs unindexed table||19||48|
|How would you convert the following SQL Statement into a stored procedure using passed in parameters with SQL Server 2008?||2||23|
|Case statement to sum values - T-SQL||3||28|
|How to improve performance of Stored Procedure in SQL Server 2014||5||13|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
11 Experts available now in Live!