Re: [SQL] all the table values equal

2010-09-21 Thread Oliveiros d'Azevedo Cristina
Yes. All the users that have only one value into the "value" column and that value is NN. Understood. Try the query from the previous mail, adding the clause WHERE "value" = NN as I did explain. Or will you need to find all the users that don't change value with just one query? And the

Re: [SQL] all the table values equal

2010-09-21 Thread Oliveiros d'Azevedo Cristina
problem Best, Oliver - Original Message - From: "Oliveiros d'Azevedo Cristina" To: "Michele Petrazzo - Unipex" Cc: Sent: Tuesday, September 21, 2010 11:25 AM Subject: Re: [SQL] all the table values equal > >>> It would help if you explain a lit

Re: [SQL] all the table values equal

2010-09-21 Thread Michele Petrazzo - Unipex
Oliveiros d'Azevedo Cristina ha scritto: OK, So, analysing your new question, the time interval is still important? Or no longer? It's important but simple to translate into sql, so I remove it from my question. So writting your query in english : "I want all users that don't change "value

Re: [SQL] all the table values equal

2010-09-21 Thread Oliveiros d'Azevedo Cristina
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

Re: [SQL] all the table values equal

2010-09-21 Thread negora
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

Re: [SQL] all the table values equal

2010-09-21 Thread Michele Petrazzo - Unipex
om: "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

Re: [SQL] all the table values equal

2010-09-20 Thread Oliveiros d'Azevedo Cristina
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'

Re: [SQL] all the table values equal

2010-09-17 Thread Michele Petrazzo - Unipex
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 w

Re: [SQL] all the table values equal

2010-09-17 Thread Oliveiros d'Azevedo Cristina
- From: "Michele Petrazzo - Unipex" To: Sent: Friday, September 17, 2010 3:50 PM Subject: [SQL] all the table values equal Hi list, this is a Friday afternoon question... :) I have a table like this: id_user | value | datetime 1 | 1 | xxx 1 | 2 | xxx+1 1 | -1 | xxx+2 2 | -1 |

[SQL] all the table values equal

2010-09-17 Thread Michele Petrazzo - Unipex
Hi list, this is a Friday afternoon question... :) I have a table like this: 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 I'm trying to create a query that say me which id_user, inside a interval of time, has all the v