Re: all the table values equal

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: all the table values equal
Date: 2010-09-21 10:25:45
Message-ID: 5E43A989C2FA4F60B146DAC454BAA21D@marktestcr.marktest.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


>> 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?
>>
>
> Yes.
>
> Re-reading my post I saw that I could explain better!
>
> id_user | value | datetime
> 1 | 1 | xxx
> 1 | 2 | xxx+1
> 1 | -1 | xxx+2
> 2 | -1 | xxx
> 2 | -1 | xxx+1
> 3 | 4 | xxx
> 3 | 10 | xxx+1
> 3 | 4 | xxx+2
> 4 | 3 | xxx
> 4 | 3 | xxx+1
>
> So, the new question: how I can find which id_user has _all_ the "value"
> that I'm looking for? Say -1 as 3 and I want a id_user=2 for the first
> and for the latter id_user=4
>

OK, So, analysing your new question, the time interval is still important?
Or no longer?
So writting your query in english : "I want all users that don't change
"value" and their value is equal to x ?"

Or will you need to find all the users that don't change value with just one
query? And the query would return something like

id_user | value
2 | -1
4| 3

?
Please advice me on this.

I am just trying to avoid misunderstanding your requirements and ending up
with a query that doesn't really do what you need.

Best,
Oliver

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Adrian Johnson 2010-09-21 11:57:59 Help with queries.
Previous Message negora 2010-09-21 08:17:07 Re: all the table values equal