Post date: Apr 14, 2014 10:54:51 PM
"What is the sum of the numbers below 1000 that are multiples of 3 or 5?"
This one is so trivial that it didn't really interest me, but in the interest of completion (who am I kidding, there are over 450 questions and I probably will lose interest before the end) ...
In the interest of not skipping the first problem on the site ...
; WITH Ten (i) AS
(
SELECT 0
UNION ALL
SELECT i + 1 FROM Ten WHERE i < 9
),
Integers (i) AS
(
SELECT 100 * h.i + 10 * t.i + o.i
FROM Ten o
CROSS JOIN Ten t
CROSS JOIN Ten h
)
SELECT SUM(i)
FROM Integers
WHERE i % 3 = 0 OR i % 5 = 0