aboutsummaryrefslogtreecommitdiff
path: root/challenge-085/abigail/sql/ch-1.sql
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-085/abigail/sql/ch-1.sql')
-rw-r--r--challenge-085/abigail/sql/ch-1.sql16
1 files changed, 16 insertions, 0 deletions
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)