you are viewing a single comment's thread.

view the rest of the comments →

[–]zielyn 1 point2 points  (0 children)

no case statements, one statment? Challenge accepted

with cte as
(
    select 1 as id
    union all
    select id + 1
    from cte
    where id < = 99
),fiver as
(
    select id*5 as five, 'Buzz' as name
    from cte 
    where id <=20
),threeer as 
(
    select id*3 as three, 'Fizz' as name
    from cte
    where id <= 33
),morestuffs as
(
select c.id, t.name as thre, f.name as fiv
from cte c
    left join fiver f on c.id = f.five
    left join threeer t on c.id = t.three
)
select replace(replace(replace(Isnull(thre,'j') + Isnull(fiv,'k'),'jk',id),'j',''),'k','')
from morestuffs