Question : SQL ORDER BY Case needed?

I have the following MS SQL SP and I want to add in a clause on the ORDER BY so if Content.Title contains @Keywords then it should appear top of the list and then number_instances DESC

Can this be done???
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
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

Answer : SQL ORDER BY Case needed?

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 case when navigation.name like '%'+@Keywords+'%'  then 1 else 2 end, number_instances DESC
GO
Random Solutions  
 
programming4us programming4us