Skip to content
Advertisement

Tag: postgresql

Get the row where the sum of a value matches a condition

I have a table with the columns: date (timestamp) num (integer) Looks like this in CSV: I want different queries to figure out the following: A: The earliest date that the sum of num is >= 1 B: The earliest date that the sum of num is >= 2 In the sample data the output would be A: 2018-02-07 and

Join one table with two other ones by id

I am trying to join one table with two others that are unrelated to each other but are linked to the first one by an id I have the following tables Then I inserted the following data Obs: The admin does not has an invite The group has an approved invitation with status 2 (because the member ‘other’ joined) The

Advertisement