From d20ff6ddb07a5495329de800382dbd02d3fd1380 Mon Sep 17 00:00:00 2001
From: Abigail <abigail@abigail.be>
Date: Thu, 5 Nov 2020 18:57:27 +0100
Subject: SQL solution for week 85/part 1.

---
 challenge-085/abigail/sql/ch-1.sql | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 challenge-085/abigail/sql/ch-1.sql

(limited to 'challenge-085/abigail/sql/ch-1.sql')

diff --git a/challenge-085/abigail/sql/ch-1.sql b/challenge-085/abigail/sql/ch-1.sql
new file mode 100644
index 0000000000..796f7f1a86
--- /dev/null
+++ b/challenge-085/abigail/sql/ch-1.sql
@@ -0,0 +1,16 @@
+--
+--  See the file ch-1.table for the definition of the used table.
+--
+--  Assumes each number of the input is on a separate row.
+-- 
+
+SELECT COUNT(*) 
+  FROM (SELECT  1
+          FROM  Numbers t1,
+                Numbers t2,
+                Numbers t3
+         WHERE  t1 . id > t2 . id 
+           AND  t2 . id > t3 . id
+           AND  1 < t1 . value + t2 . value + t3 . value
+           AND      t1 . value + t2 . value + t3 . value < 2
+         LIMIT  1)
-- 
cgit 

