In the query below, for o.EventSetName, o.EventSetDisplay, o.EventSetDescription - any time the 3 columns in the result have duplicate ROWS - only the first such row should be shown and blank for the rest of the duplicate rows.....
here is the sql:
Select distinct top 100000 o.EventSetName,
o.EventSetDisplay,
o.EventSetDescription,
o.ChildSetName,
ROW_NUMBER() Over (Order By f.ChildSetName) RN,
f.DocumentDispSequence,
f.SectionDispSequence,
o.ObsSetDispSequence,
null
From ##ObsSetLevel o,
##Final f
Where f.ChildSetName = o.EventSetName and
o.EventSetName = @variableName
Order By RN asc, f.DocumentDispSequence asc, f.SectionDispSequence asc, o.ObsSetDispSequence asc
I dont have a reporting tool so for now a lot of the reporting logic needs to be done in the stored proc itself...
So instead of:
val 1 val2 val3 val7
val 1 val2 val3 val8
val 1 val2 val3 val 10
val 1 val2 val3 x
val 1 val2 val3 y
I should get the resullt with blanks for the first 3 columns for rows 2,3,4 and 5
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…