CREATE PROCEDURE esWebsiteSearch
@Keywords nvarchar(500)
AS
SELECT Navigation.ID, Navigation.ParentID, Navigation.MicrositeID, Navigation.Name, Navigation.metaDescription, Navigation.SortOrder, count(*) as number_instances
FROM Content LEFT JOIN ContainerContent_Relationships ON ContainerContent_Relationships.ContentID = Content.ID LEFT JOIN Navigation ON Navigation.ID = ContainerContent_Relationships.SectionID WHERE Content.Title LIKE '%'+@Keywords+'%' OR Content.Content LIKE '%'+@Keywords+'%'
GROUP BY Navigation.ID, Navigation.ParentID, Navigation.MicrositeID, Navigation.Name, Navigation.metaDescription, Navigation.SortOrder
ORDER BY number_instances DESC
GO
|