Re: Recursive Queries

2020-04-16 Thread Alex Magnum
thanks for the suggestion. tablefunc extension might be the easiest one On Thu, Apr 16, 2020 at 9:46 PM Edward Macnaghten wrote: > On 16/04/2020 14:36, Edward Macnaghten wrote: > > On 16/04/2020 09:35, Alex Magnum wrote: > >> Hi, > >> I have a simple table with singup timestamps > >> > >> What I

Re: Recursive Queries

2020-04-16 Thread Edward Macnaghten
On 16/04/2020 14:36, Edward Macnaghten wrote: > On 16/04/2020 09:35, Alex Magnum wrote: >> Hi, >> I have a simple table with singupĀ timestamps >> >> What I would like to do is to create a table as shown below that >> displays the counts per our for the past n dates. SELECT hour, SUM(CASE(WHEN date

Re: Recursive Queries

2020-04-16 Thread Olivier Gautherot
is there an easy way to use recursive > queries? > > > * Counts per hour for given date* > > *HR 2020-04-01 2020-04-02 ... 2020-04-10*00 38 33 > 36 > 01 33 26 18 > 02 26 36 17 > 0

Re: Recursive Queries

2020-04-16 Thread Edward Macnaghten
On 16/04/2020 09:35, Alex Magnum wrote: > Hi, > I have a simple table with singupĀ timestamps > > What I would like to do is to create a table as shown below that > displays the counts per our for the past n dates. Various ways, but for me... SELECT hour, SUM(CASE(WHEN date = date THEN 1 ELSE 0)),

Re: Recursive Queries

2020-04-16 Thread Michael Lewis
You don't want recursion, you want pivot table (Excel) behavior to reformat rows into columns. The easiest way to get this data in its raw form would be to group by date and hour of day and compute the count. If you have the option to add extensions in your environment, then you should be able to

Re: Recursive Queries

2020-04-16 Thread Julien Rouhaud
On Thu, Apr 16, 2020 at 2:49 PM Rob Northcott wrote: > > From: Alex Magnum > > What I would like to do is to create a table as shown below that displays the > counts per our for the past n dates. > > > > I can do this with a function but is there an easy way

RE: Recursive Queries

2020-04-16 Thread Rob Northcott
From: Alex Magnum Sent: 16 April 2020 09:36 To: Postgres General Subject: Recursive Queries Hi, I have a simple table with singup timestamps What I would like to do is to create a table as shown below that displays the counts per our for the past n dates. I can do this with a function but is

Recursive Queries

2020-04-16 Thread Alex Magnum
Hi, I have a simple table with singup timestamps What I would like to do is to create a table as shown below that displays the counts per our for the past n dates. I can do this with a function but is there an easy way to use recursive queries? * Counts per hour for given date* *HR 2020