Created
September 5, 2014 15:39
-
-
Save eerrecart/d0fb5ee11fe35ffe294a to your computer and use it in GitHub Desktop.
Umbraco - Get only image folders with childrens
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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