Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SELECT
user_id,
1 AS view_homepage,
min(time) AS view_homepage_time
FROM event
WHERE
data->>'type' = 'view_homepage'
GROUP BY user_id
@daemonfire300

This comment has been minimized.

Copy link

daemonfire300 commented Dec 2, 2014

 data->>'type' = 'view_homepage'

I've never seen this sytnax in Postgresql what does it mean, and where is it in the official docs?

@renzok

This comment has been minimized.

Copy link

renzok commented Dec 3, 2014

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
You can’t perform that action at this time.