<p>Ok: This is some of my table structure that matters here</p>

<pre><code>CaseStudyID int
Title nvarchar(50)
OverrideTitle nvarchar(50)
</code></pre>

<p>Part of my procedure</p>

<pre><code>Declare @Temp table(CaseStudyID int,
            Title nvarchar(50))

Insert Into @Temp 
SELECT CaseStudyID,Title 
FROM CaseStudy 
WHERE Visible = 1 AND DisplayOnHomePage = 1 
ORDER BY Title

Update @Temp Set Title = TitleOverride 
--Here is where im lost if the title occurs more than once
--I need to replace it with the override
--Schoolboy error or leaking brain I cant get it going


Select * From @Temp
</code></pre>

<p>Can anyone help?</p>

You could achieve it without using tempory table this way:
```
```
SELECT 
    MIN(CaseStudyID) AS CaseStudyID, 
    CASE WHEN count(*) = 1 THEN 
       MIN(Title) 
    ELSE
       MIN(OverrideTitle) 
    END AS Title
FROM CaseStudy
GROUP BY Title
ORDER BY Title
```
```