How can I add this to the case statement of the query or just to the query to check...
If fileddate <> filedate then use the min filedate and place in the title field the word 'concurr' for the one record.
I have this query doing it already but it does it for filedates matching.
Select distinct p.CLMS, p.DOC,
p.Reg,
n.RegionAcronym,
p.FO,
Age = Datediff(day,max(p.filedate), getdate()),
FileDate = max(FileDate),
o.mailingaddressstate as DDS,
o.ddsofficecode as DDSCode,
Min(ddsrcpt) AS DDSReceipt,
DDSAge = Datediff(day,min(p.ddsrcpt), getdate()),
Title = case when min(p.Title) <> max(p.Title) then 'Concurr' else min(p.Title) end
From pendingdds p
join Offices.dbfficeCodes d
on d.officecode = p.doc
join natdocfile n
on n.doc = p.fo
join offices.dbo.doorsinfo o
on o.officecode = p.fo
where p.doc ='s09'
AND ( Datediff(DAY, filedate, Getdate()) > 300 )
Group By p.fo, p.Reg, n.regionacronym,p.DOC, p.CLMS, o.ddsofficecode,
o.mailingaddressstate
order by clms
How can I add to the bold section or add on to the title section to get what I want.
If fileddate <> filedate then use the min filedate and place in the title field the word 'concurr' for the one record.
I have this query doing it already but it does it for filedates matching.
Select distinct p.CLMS, p.DOC,
p.Reg,
n.RegionAcronym,
p.FO,
Age = Datediff(day,max(p.filedate), getdate()),
FileDate = max(FileDate),
o.mailingaddressstate as DDS,
o.ddsofficecode as DDSCode,
Min(ddsrcpt) AS DDSReceipt,
DDSAge = Datediff(day,min(p.ddsrcpt), getdate()),
Title = case when min(p.Title) <> max(p.Title) then 'Concurr' else min(p.Title) end
From pendingdds p
join Offices.dbfficeCodes d
on d.officecode = p.doc
join natdocfile n
on n.doc = p.fo
join offices.dbo.doorsinfo o
on o.officecode = p.fo
where p.doc ='s09'
AND ( Datediff(DAY, filedate, Getdate()) > 300 )
Group By p.fo, p.Reg, n.regionacronym,p.DOC, p.CLMS, o.ddsofficecode,
o.mailingaddressstate
order by clms
How can I add to the bold section or add on to the title section to get what I want.