Re: group by hour + distinct

From: "Oliveiros d'Azevedo Cristina" <oliveiros(dot)cristina(at)marktest(dot)pt>
To: "Michele Petrazzo - Unipex" <michele(dot)petrazzo(at)unipex(dot)it>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: group by hour + distinct
Date: 2010-11-26 13:15:14
Message-ID: D352FB1B6AD34FC1A0E5052DB2A786A5@marktestcr.marktest.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Lew 2010-11-26 16:07:05 Re: group by hour + distinct
Previous Message Michele Petrazzo - Unipex 2010-11-26 12:42:55 Re: group by hour + distinct