From 8b47b78614299004d7f900b52b3a879f44331f37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Tue, 14 Apr 2015 18:10:11 +0200 Subject: [PATCH 1/3] --- oij | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 oij diff --git a/oij b/oij new file mode 100644 index 0000000..336aad4 --- /dev/null +++ b/oij @@ -0,0 +1,11 @@ +SELECT count(*) AS C, payload->'retweeted_status'->>'id' AS cat, payload->'retweeted_status'->>'text' AS Tweet FROM messages WHERE jsonb_typeof(payload) = 'object' and payload->>'text' not like '%http%' GROUP BY cat, Tweet ORDER BY C DESC; +# Works just fine + + +SELECT count(*) AS C, payload->'retweeted_status'->>'id' AS cat, payload->'retweeted_status'->>'text' AS Tweet, payload->'retweeted_status'->'User'->>'screen_name' AS User FROM messages WHERE jsonb_typeof(payload) = 'object' and payload->>'text' not like '%http%' GROUP BY cat, Tweet, User ORDER BY C DESC; +# Doesn't work +# ------------ +# ERROR: column "messages.payload" must appear in the GROUP BY clause or be used in an aggregate function +# LINE 1: ...t, payload->'retweeted_status'->>'text' AS Tweet, payload->'... + +#Problem: User was the name of a column :) From c4fc4cfc9285803bb32b2aae13d7ca32666f26ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Tue, 14 Apr 2015 09:10:27 -0700 Subject: [PATCH 2/3] --- oij => gistfile1.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename oij => gistfile1.sql (100%) diff --git a/oij b/gistfile1.sql similarity index 100% rename from oij rename to gistfile1.sql From 9e927e208975fb296a0f1e00cc050c5998d7d521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Tue, 14 Apr 2015 09:15:02 -0700 Subject: [PATCH 3/3] --- gistfile1.sql => Error SQL | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename gistfile1.sql => Error SQL (100%) diff --git a/gistfile1.sql b/Error SQL similarity index 100% rename from gistfile1.sql rename to Error SQL