Welcome Guest   •   Login

Sitecore Rocks

RSS RSS




Search the wiki
»

PoweredBy

Sitecore Select Query Samples

RSS

Simple Select statement

select * from /sitecore/content/Home

Select child items

select * from /sitecore/*

Select descendents

select * from /sitecore//*

Select descendents with filter

select * from /sitecore//*[@Title = "Welcome to Sitecore"]

Select columns

select @Title, @Text from /sitecore/content/Home

Select columns with aliases

select @Title as Caption, @Text as Body from /sitecore/content/Home

Select expression

select @Title + ", " + @Text as Value from /sitecore/content/Home

Select item ID

select @@ID from /sitecore/content/Home

Select item name

select @@Name from /sitecore/content/Home

Select item path

select @@Path from /sitecore/content/Home

Select item template

select @@TemplateID, @@TemplateName, @@TemplateKey from /sitecore/content/Home

Select with space escaping

If a field contains a space, the field name can be escaped using hashes #.

select @#Body Text# from /sitecore/content/Home

Select using Distinct

select distinct @Title from /sitecore/content/*

Select using Order By

Notice that the result set is order by column names, not field names.

select @@Name as Name from /sitecore/content//* order by Name

Select using Order By descendent

Notice that the result set is order by column names, not field names.

select @@Name as Name from /sitecore/content//* order by Name desc

Select using Distinct and Order By

select distinct Name as Name from /sitecore/content//* order by Name

ScrewTurn Wiki version 3.0.4.560. Some of the icons created by FamFamFam.