Skip to content

Instantly share code, notes, and snippets.

@jpcaparas
Last active June 30, 2016 21:16
Show Gist options
  • Save jpcaparas/69886fbf2682ff487866f0df38541d3f to your computer and use it in GitHub Desktop.
Save jpcaparas/69886fbf2682ff487866f0df38541d3f to your computer and use it in GitHub Desktop.
Sandfield CMS Stored procedures
/**
Fetch an article based on its ID:
Fields required:
- Type
- Title
- Description
- Thumbnail
- Published time
- Modified time
- Section/category
TODO: On the where clause, specify article ID
**/
SELECT
[ArticleType].[Name] as ArticleType
,[Article].[Title]
,[Article].[Description]
,[Article].[ThumbnailImage]
,[Article].[Created]
,[Article].[LastModified]
,[ArticleCategory].Name as CategoryName
FROM [CMS_SAL_DEV].[CMS].[Article] Article
LEFT JOIN [CMS_SAL_DEV].[CMS].[ArticleType] ArticleType
ON [Article].[ArticleTypeID] = [ArticleType].[ArticleTypeID]
LEFT JOIN [CMS_SAL_DEV].[CMS].[ArticleCategory] ArticleCategory
ON [ArticleType].[ArticleTypeID] = [ArticleCategory].[ArticleCategoryID]
WHERE [Article].[ArticleID] = 1
ORDER BY [Article].[Created] DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment