Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Two WHERE CLAUSE in ##WHERE## macro View modes: 
User avatar
Certified Developer 12
Certified Developer 12
chetan2309-gmail - 8/19/2013 7:15:53 AM
   
Two WHERE CLAUSE in ##WHERE## macro
Can we assign at two places value of ##WHERE## macro. I need in this way because I am calculating its value based on querystring paramter.

This is my query
Select Sub.* From
(
Select ROW_NUMBER() OVER (PARTITION BY Specie ORDER BY Specie) AS [row_number],
SiteName, NodeAliasPath, DocumentNamePath,[ArticleID],[Headline]
,[Author],[Summary],[Image],[FullArticle],[Video],[Quotes]
,[Specie],[Date]
From View_CMS_Tree_Joined INNER JOIN pm_article ON
DocumentForeignKeyValue = pm_article.ArticleID
Where ClassName IN ('pm.Article') and Specie = Case 'All' When 'All' Then Specie Else 'Horses' END
) Sub
Where Sub.Row_Number <= Case 'All' When 'All' Then 2 ELSE Sub.Row_Number END

The last where clause I wish to put in 2nd ##WHERE## macro

User avatar
Member
Member
vcarter - 8/19/2013 9:11:36 AM
   
RE:Two WHERE CLAUSE in ##WHERE## macro
You could just take everything from after the first WHERE:
 ClassName IN ('pm.Article') and Specie = Case 'All' When 'All' Then Specie Else 'Horses' END
) Sub
Where Sub.Row_Number <= Case 'All' When 'All' Then 2 ELSE Sub.Row_Number END

And make that a single where clause. I think Kentico will process it all at once.