Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Select Distinct with LOB fields

Re: Select Distinct with LOB fields

From: Shakespeare <whatsin_at_xs4all.nl>
Date: Sun, 16 Sep 2007 11:15:09 +0200
Message-ID: <46ecf442$0$245$e4fe514c@news.xs4all.nl>

<kochegarny_at_stream.ru> schreef in bericht news:fchbhk$h3e$1_at_aioe.org...
> Shakespeare wrote:
>
>>
>> "cleveridea" <cleveridea.net_at_gmail.com> schreef in bericht
>> news:1189025071.389131.137750_at_d55g2000hsg.googlegroups.com...
>>> On Sep 5, 10:54 am, "Andy Fish" <ajf..._at_blueyonder.co.uk> wrote:
>>>> ok, maybe I didn't phrase the question very well as everyone came up
>>>> with similar responses. consider this scenario:
>>>>
>>>> create table foo (pk integer, data clob)
>>>> create table bar (pk integer, fk integer)
>>>>
>>>> select foo.pk, foo.data from foo, bar where foo.pk = bar.fk
>>>>
>>>> because several rows in bar might join to the same row in foo, this
>>>> query could return duplicate rows
>>>>
>>>> i cannot use select distinct because I need to return all columns from
>>>> foo
>>>>
>>>> because I am only returning columns from foo, I know that uniqueness
>>>> could
>>>> be determined by checking only foo.pk
>>>>
>>>> hope that makes it clearer.
>>>>
>>>> Andy
>>>>
>>>
>>> I like using 'exists' more than 'in' - not certain it makes a
>>> difference to the CBO.
>>>
>>> select foo.pk, foo.data
>>> from foo
>>> where exists ( select null from bar where foo.pk = bar.fk );
>>>
>>
>> I would not use select null here... It works, but I have seen some
>> discussions about null before in this group ;-)
>>
>> Shakespeare
> test

??????

YES IT WORKS .. ??? Shakespeare Received on Sun Sep 16 2007 - 04:15:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US