日期:2014-05-17 浏览次数:20437 次
;with maco as ( select number as c from master..spt_values where type='p' and number between 0 and 9 ) select case when a.c=0 then '' else ltrim(a.c)+'+' end +ltrim(b.c)+'+'+ltrim(c.c)+'+'+ltrim(d.c)+'=14' from maco a ,maco b,maco c ,maco d where a.c<b.c and b.c<c.c and c.c<d.c and a.c+b.c+c.c+d.c=14 /* 1+4+9=14 1+5+8=14 1+6+7=14 2+3+9=14 2+4+8=14 2+5+7=14 1+2+3+8=14 1+2+4+7=14 1+2+5+6=14 3+4+7=14 3+5+6=14 1+3+4+6=14 2+3+4+5=14 */