SO Popularity Contest

0

Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

CREATE TABLE #KeyTags (
    value VARCHAR(100) COLLATE SQL_Latin1_General_CP1_CS_AS);
GO 
INSERT INTO #KeyTags (value) 
SELECT * FROM STRING_SPLIT(##CommaSeparatedOptions:string##, ',');
GO
--ALTER TABLE #key_word_table 
--  ALTER COLUMN value
--    VARCHAR(50) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL;
--GO
-- ta-lib,    alpha-vantage,,yahoo-finance,yfinance,google-finance
-- SQL_Latin1_General_CP1_CI_AS" and "SQL_Latin1_General_CP1_CS_AS
-- 
--SELECT * FROM #KeyTags
--
SELECT #KeyTags.value, 
SUM(CAST(ViewCount AS BIGINT))AS viewed, 
Count(Posts.ViewCount) as question,
SUM(CASE WHEN ((Posts.AnswerCount < 1) AND (Posts.ClosedDate IS NULL)) THEN 1 ELSE 0 END) 
                               As unanswered_question                             
FROM Posts JOIN #KeyTags ON Posts.Tags LIKE CONCAT('%<', #KeyTags.value,'>%')
WHERE Posts.PostTypeId = 1 
AND Posts.Tags LIKE '%<%' 
GROUP BY value
ORDER BY viewed DESC;

Enter Parameters

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