I'm having some problems with a SQL stored procedure which I hoped somebody might be able to shed some light on for me.
I wish to return all the rows in this query but only one item for each Type_ID and Item_ID.
i.e. if there are multiple entries with the same Type_ID *and* Item_ID, only return the first.
I've included my table (temporary for the time being) and query below.
Thanks in advance for any help you can give me.
SELECT *, ROW_NUMBER() OVER (ORDER BY Due_Date DESC) as Row FROM #OutputTable WHERE ISNULL(IsCompleted,0)=0 AND [TYPE_ID] IN (4,5) ORDER BY Due_Date DESC
CREATE TABLE #OutputTable