Re: build a query

From: Andreas Mosmann <mosmann_at_expires-31-08-2011.news-group.org>
Date: Thu, 18 Aug 2011 01:07:19 +0200
Message-ID: <1313622439.48_at_user.newsoffice.de>



Paolo Fossati schrieb am 17.08.2011 in
<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

You find all ref that are in *at*least* 2 locations with different objects.
Should be the answer of your question, isn't it?

Andreas

-- 
wenn email, dann AndreasMosmann <bei> web <punkt> de
Received on Wed Aug 17 2011 - 18:07:19 CDT

Original text of this message