Getting COUNT from different tables #2069
-
I have got two tables, 'page_visits' and 'comments', which store new webpage visits and new comments, respectively. PAGE_VISITS
COMMENTS
I want to aggregate the data from both the tables in the past 1 hour to use for analytics, such that it looks like the table below. PAGE_DATA
I have the above code as of now, however, it only prints the row when comment_count is null, but it does not do the same when visit_count is 0 and comment_count is > 0. Secondly, I am trying to run this code every hour with the use of pg_cron and I know that I can run a function directly in a cron scheduler, however, I am unable to turn the above code into a working function. Could someone help me out with these 2 issues? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I can't see how this question is related to PostgREST. Seems to be related to SQL / PostgreSQL only. |
Beta Was this translation helpful? Give feedback.
I can't see how this question is related to PostgREST. Seems to be related to SQL / PostgreSQL only.