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] --- 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 :)