Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers. It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.
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
Join the community of 500,000 technology professionals and ask your questions.