Skip to content

Tag: postgresql

Database Query to generate a Time-based Chart

I have a logins table in the following (simplified) structure: Now I want to generate chart like this: Basically I want to show the logins within the past 48 hours. My current query: This works as long as there are entries for every hour. However, if in some hour there were no logins, there will be no entry selected,

Can PostgreSQL JOIN on jsonb array objects?

I am considering switching to PostgreSQL, because of the JSON support. However, I am wondering, if the following would be possible with a single query: Let’s say there are two tables: Table 1) organisations: Table 2) users: Now I want to get a result like this (all i have is the ID of the organisation [1]): I know this is