Re: an difficult SQL

2022-11-06 Thread Rafal Pietrak
Great, with a little tweaking (to get the remaining rows ordered correctly), this did the job. Thank you Erik. BR -R W dniu 6.11.2022 o 15:23, Erik Wienhold pisze: On 06/11/2022 13:48 CET Rafal Pietrak wrote: W dniu 5.11.2022 o 19:05, Thiemo Kellner pisze: You first could select the thre

Re: an difficult SQL

2022-11-06 Thread Erik Wienhold
> On 06/11/2022 13:48 CET Rafal Pietrak wrote: > > W dniu 5.11.2022 o 19:05, Thiemo Kellner pisze: > > > > You first could select the three users with the most recent entries with > > a windowing function > > (https://www.postgresql.org/docs/15/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS) > > sur

Re: an difficult SQL

2022-11-06 Thread Rafal Pietrak
Hi Thiemo, Thank you for suggestions. W dniu 5.11.2022 o 19:05, Thiemo Kellner pisze: Hi Rafal You first could select the three users with the most recent entries with a windowing function (https://www.postgresql.org/docs/15/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS) surely I'm missing

Re: an difficult SQL

2022-11-05 Thread Thiemo Kellner
Hi Rafal You first could select the three users with the most recent entries with a windowing function (https://www.postgresql.org/docs/15/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS) putting it into a with query (https://www.postgresql.org/docs/15/sql-select.html), in following with querie

an difficult SQL

2022-11-05 Thread Rafal Pietrak
Hi Everybody, I was wondering if anybody here could help me cook up a query: 1. against a list of events (like an activity log in the database). The list is a single table: create table events (tm timestamp, user int, description text). 2. of which the output would be sorted in such a way, t