Re: build a query

From: Paolo Fossati <fossati_apoloNOSPAM_at_hotmail.com>
Date: Wed, 17 Aug 2011 22:51:33 +0200
Message-ID: <4e4c29d5$0$6839$5fc30a8_at_news.tiscali.it>



Il 17/08/2011 18:30, Gerard H. Pille ha scritto:
> Michel Cadot wrote:

>> "Paolo Fossati"<fossati_apoloNOSPAM_at_hotmail.com> a écrit dans le
>> message de news: 4e4bd509$0$6840$5fc30a8_at_news.tiscali.it...
>> | hi all,
>> |
>> | i'm trying (with no success ) to build an oracle query , db is oracle
>> | 10, os windows 2008 64 bit
>> |
>> | in a table called "location" i have :
>> |
>> | REF location object_count
>> |
>> | 1000 a 22
>> | 1000 b 22
>> | 1001 a 57
>> | 1001 b 55
>> | .
>> | .
>> | .
>> |
>> | the same object (see the 1001 example ) is existing in 2 different
>> | locations (a and b) but the number on objects are not the same (in one
>> | place are 57, in the other 55)
>> | As this number must be the same in all the locations for the same ref
>> | (see the 1000 example), how can i spot with query all the refs thar are
>> | not the same?
>> |
>> | thanks a lot fot your help
>> | Paolo
>>
>> All are different or some are different?
>>
>> Regards
>> Michel
>>
>>
>
> select ref from (select distinct ref, object_count from location) group
> by ref having count(*) > 1

thanks a lot for the answer,
in this wan i can find all the ref that are in 2 locations with different object_count?
i'll try tomorrow... thanks again
Paolo Received on Wed Aug 17 2011 - 15:51:33 CDT

Original text of this message