I have a sql query which i managed to filter joining different tables, Below
- NoOfCounts - Duplicate count of same Question in a Form having different Answer
- NoOfRowsPerAnserId - Used a Rank Partition by and order by AnswerId
My resultset looks somewhat like this now,
What I expect ( I just omitted other column but it can be there if this is not possible)
Query I have
CREATE Table #myData ( Id INT Identity (1,1) ,NoOfCounts INT ,NoofRowsPerAnswerId_RankFunction INT, AnswerId INT, Value NVARCHAR(256) , FormId INT, QuestionId INT, AnserNameofItem NVARCHAR(256), DesiredValue NVARCHAR(256))
INSERT INTO #myData
VALUES
(1,1,11,90,101,1,'Equity','')
,(2,1,22,$1000,101,2,'CashInFlow','')
,(2,2,22,$1001,101,2,'CashOutflow','')
,(3,1,33,$99,101,3,'Chase','')
,(3,2,33,$100,101,3,'Capital','')
,(3,3,33,$101,101,3,'Citi','')
,(4,1,44,$800,101,4,'Equity','')
,(4,2,44,$801,101,4,'Fund','')
,(4,3,44,$802,101,4,'Credit','')
,(4,4,44,$804,101,4,'Debit','')
SELECT * FROM #myData