clear markdown feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3798821 fiddles created (41840 in the last week).

CREATE table t(s int,i int identity) INSERT t values(9),(3),(1),(2),(2),(9),(1),(1),(1); WITH c(a,b,x)as(SELECT*,1FROM t UNION ALL SELECT t.*,x+1FROM c,t WHERE a+b=i)SELECT max(x)FROM c
(No column name)
 hidden batch(es)