I'm afraid there's nothing pretty and you'll just have to do selectoldestrange = 'Your oldest range is ...' + case when range2 is not null then 'range2' when range1 is not null then 'range1' when rangeO is not null then 'range0' end + ' days and the amount is ' + CAST(coalesce(range2,range1,rangeO) as nvarchar(50))from table(I've used range1, range2 rather than "120+" etc)here's my example codecreate table #a (id int identity(1,1), rangeO int , range1 int , range2 int)insert into #a (rangeO, range1, range2) select NULL,10,200insert into #a (rangeO, range1, range2) select 7,3,NULLinsert into #a (rangeO, range1, range2) select 90,1,111insert into #a (rangeO, range1, range2) select NULL,NULL,45insert into #a (rangeO, range1, range2) select 100,NULL,NULLinsert into #a (rangeO, range1, range2) select 120,10,50select * from #aselect id, oldestrange = 'Your oldest range is ...' + case when range2 is not null then 'range2' when range1 is not null then 'range1' when rangeO is not null then 'range0' end + ' days and the amount is ' + CAST(coalesce(range2,range1,rangeO) as nvarchar(50))from #adrop table #a
--I hope that when I die someone will say of me "That guy sure owed me a lot of money"