Re: group by hour + distinct - Mailing list pgsql-sql

From Oliveiros d'Azevedo Cristina
Subject Re: group by hour + distinct
Date
Msg-id D352FB1B6AD34FC1A0E5052DB2A786A5@marktestcr.marktest.pt
Whole thread Raw
In response to group by hour + distinct  (Michele Petrazzo - Unipex <michele.petrazzo@unipex.it>)
List pgsql-sql
>
> Ciao
>
* Olá!

>> for each hour it will count the number of distinct user_id's there
>> are . If I understood correctly what you need...
>>
>> Can you please test it and see if it is OK for your needs? With me,
>> it worked on the sample data you provided
>>
>
> Yes! Simply perfect!
>

* Great to hear it worked !

>>
>
> Thanks,
> Michele
* Don't mention it ;-)

>
> P.s. Have you some references about the "subquery" keyword? I found only
> the word subquery as "use" (for example: select a from b where id in 
> (select id from table)), but not as sql command.
>
>

* I don't know subquery as an SQL keyword too. In the query I gave you the 
"subquery" thing was just an alias. Such kind of things are mandatory. If I 
try to omit it, I get this error

ERROR:  subquery in FROM must have an alias
HINT:  For example, FROM (SELECT ...) [AS] foo.

********** Erro **********

ERROR: subquery in FROM must have an alias
Estado de SQL:42601
Sugestão:For example, FROM (SELECT ...) [AS] foo.

So, even though the "subquery" alias was not used anywhere else, I believe 
it had to be there, otherwise the SQL parser would complain


Best,
Oliver



pgsql-sql by date:

Previous
From: Michele Petrazzo - Unipex
Date:
Subject: Re: group by hour + distinct
Next
From: ndias
Date:
Subject: Insert row in 1.10.1 and 1.10.3