Last active
August 29, 2015 14:09
-
-
Save drob/4209925d8d3499e02a04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
user_id, | |
1 AS view_homepage, | |
min(time) AS view_homepage_time | |
FROM event | |
WHERE | |
data->>'type' = 'view_homepage' | |
GROUP BY user_id |
data is of type json and ->> is an operator which gets a JSON object field as text. Here the object field has name 'type' and its values (casted to text) get compared to 'view_homepage'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've never seen this sytnax in Postgresql what does it mean, and where is it in the official docs?