Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 8693A1335ED4 for ; Mon, 20 Sep 2010 06:29:31 -0300 (ADT) 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 83461-07 for ; Mon, 20 Sep 2010 09:29:24 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from jupiter.marktest.pt (delta.marktest.pt [80.251.174.116]) by mail.postgresql.org (Postfix) with ESMTP id 102211337B49 for ; Mon, 20 Sep 2010 06:29:22 -0300 (ADT) Received: from Proteu (proteu.marktest.pt [10.61.90.54]) by jupiter.marktest.pt with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id SBPTZA5A; Mon, 20 Sep 2010 10:29:21 +0100 Message-ID: <81C545E3469E4DF58720C282A469E78A@marktestcr.marktest.pt> From: "Oliveiros d'Azevedo Cristina" To: "Michele Petrazzo - Unipex" Cc: References: <4C93803A.4080706@unipex.it> <438B32316EF6496D9641819BA16447A2@marktestcr.marktest.pt> <4C938D09.3050105@unipex.it> Subject: Re: all the table values equal Date: Mon, 20 Sep 2010 10:29:21 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.51 tagged_above=-5 required=5 tests=BAYES_05=-0.5, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201009/55 X-Sequence-Number: 34586 Hello again, Michele, I haven't open my mailbox during weekend so I couldn't follow up your question. It would help if you explain a little better the background of the problem you're trying to solve. You want to find all the user IDs which have the same value on a given time interval? Is my understanding correct? Best, Oliver ----- Original Message ----- From: "Michele Petrazzo - Unipex" To: "Oliveiros d'Azevedo Cristina" Cc: Sent: Friday, September 17, 2010 4:45 PM Subject: Re: [SQL] all the table values equal > Oliveiros d'Azevedo Cristina ha scritto: >> Howdy , Michele, >> >> Give this a try >> >> SELECT id_user FROM t_your_table WHERE datetime BETWEEN A -- plug >> here beginning of interval AND B -- and end here GROUP BY id_user >> HAVING COUNT(*) = -SUM(value) >> >> Then tell me if it gives you what you want > > > Thanks, > it works, but... it's really a trickle that exploits the value -1 if I > understand how its work. > If there is another value where look for? Example 13? > > Thanks > > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql