Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 7A74D1337B43 for ; Fri, 26 Nov 2010 08:43:03 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 61936-09 for ; Fri, 26 Nov 2010 12:42:57 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp.go-wipex.it (mx1.go-wipex.it [89.202.235.7]) by mail.postgresql.org (Postfix) with ESMTP id 220AA1337B77 for ; Fri, 26 Nov 2010 08:42:56 -0400 (AST) Received: from unipex-local-server (unipex.wipex [172.16.20.247]) by smtp.go-wipex.it (Postfix) with ESMTP id DD8A110B00BA; Fri, 26 Nov 2010 13:42:55 +0100 (CET) Received: from [192.168.1.103] (michele [192.168.1.103]) by unipex-local-server (Postfix) with ESMTP id 99960560001; Fri, 26 Nov 2010 13:42:53 +0100 (CET) Message-ID: <4CEFAB4F.6000109@unipex.it> Date: Fri, 26 Nov 2010 13:42:55 +0100 From: Michele Petrazzo - Unipex User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1b1) Gecko/20060724 Thunderbird/2.0a1 Mnenhy/0.7.4.0 MIME-Version: 1.0 To: Oliveiros d'Azevedo Cristina CC: pgsql-sql@postgresql.org Subject: Re: group by hour + distinct References: <4CEF9C66.30100@unipex.it> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201011/69 X-Sequence-Number: 34807 Oliveiros d'Azevedo Cristina ha scritto: > Howdy, Michelle, > Ciao > 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! > Best, Oliver > Thanks, Michele 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.