Skip to content

Tag: postgresql

UNION ALL not combining rows

I have this table called “valores_indices” where it imports stocks values every 1 hour, I need to get the values from each monitored stock at 8am and 6pm, those being respectively my “vlrAberto” and “vlrFechado” selects I don’t get why these are not merging, I’v…

Cannot use SQL Lead function correctly

I have a table with 4 columns: date, event_name, video_id and user_id. I need to write a query that will return the number of users who viewed at least one video in a given day and the number of those users who returned the next day to view at least one video. The video_play event signifies that a video was

SQL (MYSQL, Postgres) Lookup/report table

I’m basically making a lookup table for my three tables but its not doing what I want. Those 3 tables were created by loading 3 different csv files. What I’m trying to do is inserting the ID’s from those tables into the lookup one. This is what I keep getting: What I need is: I kind of get w…