pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt>
To: Michele Petrazzo - Unipex <michele.petrazzo@unipex.it>
Cc: pgsql-sql@postgresql.org
Subject: Re: group by hour + distinct
Date: Fri, 26 Nov 2010 13:15:14 -0000
Message-ID: <D352FB1B6AD34FC1A0E5052DB2A786A5@marktestcr.marktest.pt> (raw)
References: <4CEF9C66.30100@unipex.it>
	<FC442338870D492A930770CD23660616@marktestcr.marktest.pt>
	<4CEFAB4F.6000109@unipex.it>


>
> 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




view thread (5+ messages)  latest in thread

Message-ID: <D352FB1B6AD34FC1A0E5052DB2A786A5@marktestcr.marktest.pt>
Permalink:  ../D352FB1B6AD34FC1A0E5052DB2A786A5@marktestcr.marktest.pt/
Also on:    postgresql.org/message-id/D352FB1B6AD34FC1A0E5052DB2A786A5@marktestcr.marktest.pt

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: oliveiros.cristina@marktest.pt, michele.petrazzo@unipex.it
  Subject: Re: group by hour + distinct
  In-Reply-To: <D352FB1B6AD34FC1A0E5052DB2A786A5@marktestcr.marktest.pt>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox