<pre> with Notesdate as ( select KeyID,InsertedDate,NOTEID,ROW_NUMBER() over(Partition by KEYID order by InsertedDate desc) as ROWNUMBER from Note ) --select inserteddate,KEYID from Notesdate ND where rownumber=1 SELECT Distinct CASE WHEN LV.TypeName LIKE '%NOTES%' THEN 'Notes' END AS Name, CASE WHEN LV.TypeName LIKE '%NOTES%' THEN -- THEN N.InsertedDate= (Select inserteddate from Notesdate where ROWNUMBER=1 ) FROM dbo.NOT N Inner JOiN Notesdate ND On ND.NoteID=N.NoteID WHERE N.InsertedByUserID<>'0'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)