Created
April 10, 2019 14:08
-
-
Save regme/462ccc42e059dfa565a30ce2a199118f to your computer and use it in GitHub Desktop.
Indicators histogram
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select ind.NewsHeadlinesIndicatorId, ind.Title, ii.cnt from NewsHeadlinesIndicator ind | |
join ( | |
select NewsHeadlinesindicatorId, count(*) as cnt from ( | |
SELECT [NewsHeadlinesIndicatorId] | |
,[FundId] | |
,[EventDTM] | |
,[NewsHeadlinesZoneId] | |
,[Trend] | |
,[OccurrencesTotal] | |
,[OccurrencesChecked] | |
,[PeriodLength] | |
,[Weight] | |
,[Gain] | |
,RANK() over (partition by FundId order by Weight desc) as rn | |
FROM [dbo].[NewsHeadlines] | |
) i where i.rn = 1 | |
group by NewsHeadlinesIndicatorId | |
) ii | |
on ind.NewsHeadlinesIndicatorId = ii.NewsHeadlinesIndicatorId | |
order by 3 desc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment