Skip to content

Instantly share code, notes, and snippets.

@eerrecart
Created September 5, 2014 15:39
Show Gist options
  • Save eerrecart/d0fb5ee11fe35ffe294a to your computer and use it in GitHub Desktop.
Save eerrecart/d0fb5ee11fe35ffe294a to your computer and use it in GitHub Desktop.
Umbraco - Get only image folders with childrens
Declare @folders TABLE (id int , path nvarchar(300) COLLATE SQL_Latin1_General_CP1_CI_AS)
insert into @folders
select
id, path, text
from
umbracoNode as N
INNER JOIN cmsContent as C ON C.nodeId = N.id
INNER JOIN cmsContentType as CT ON C.contentType = CT.nodeId and CT.alias = 'folder'
-- carpetas con hijos
select
F.id
from
umbracoNode as N
INNER JOIN cmsContent as C ON C.nodeId = N.id
INNER JOIN cmsContentType as CT ON C.contentType = CT.nodeId and (CT.alias = 'folder' or CT.alias = 'image')
INNER JOIN @folders as F ON F.path like N.path + ',%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment