questions without code examples; parameters: tags/keywords/minimum score

0

Please login or register to vote for this query.

(click on this box to dismiss)

Hinduism Meta

Q&A about the site for followers of the Hindu religion and those interested in learning more about Hinduism

-- Top score question to given tags/keywords/min score --
-- without code examples --



DECLARE @Tag1 VARCHAR(30) = ##FirstTagOrKeyword:string##;
SET     @Tag1             = '%' + LTRIM(RTRIM(@Tag1)) + '%';
DECLARE @Tag2 VARCHAR(30) = ##SecondTagOrKeyword:string##;
SET     @Tag2             = '%' + LTRIM(RTRIM(@Tag2)) + '%';
DECLARE @Tag3 VARCHAR(30) = ##ThirdTagOrKeyword:string##;
SET     @Tag3             = '%' + LTRIM(RTRIM(@Tag3)) + '%';
-- Search Tags and Keywords in Header  

DECLARE @MinScore int     = ##MinimumScore##
-- min Score

 SELECT    Id AS [Post Link], Title, Score, Tags, ViewCount, AnswerCount, CommentCount, FavoriteCount, OwnerUserId 
FROM       Posts q 
WHERE      PostTypeId = 1
AND        ((q.Tags LIKE @Tag1 AND q.Tags LIKE @Tag2 AND q.Tags LIKE @Tag3) 
OR         (q.Title LIKE @Tag1 AND q.Title LIKE @Tag2 AND q.Title LIKE @Tag3)
OR         (q.Body LIKE @Tag1 AND q.Body LIKE @Tag2 AND q.Body LIKE @Tag3))
--AND        (q.Body NOT LIKE '%pre%')
-- No <pre> allowed, most Code Block starts with <pre><code> 

--Other Options 
 AND        (q.Body LIKE '%<pre><code>%')
-- AND        (q.Body NOT LIKE '%<pre><code>%</code></pre>%')
AND         q.Score >= @MinScore

ORDER BY   Score DESC

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results