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: SQL statement using 'IN' clause

Re: SQL statement using 'IN' clause

From: C. Mason <cmason_at_aai.arco.com>
Date: Mon, 28 Sep 1998 22:31:20 GMT
Message-ID: <F00MHq.9Hv@news.arco.com>


Why not use WHERE POSTCODE LIKE 'OX6%' OR POSTCODE LIKE 'L1%' ? Naidenov wrote in message <360B9BC5.17D72C13_at_animabank.spb.ru>...
>Hi,
> may be that statment:
>
> select * from contact where postcode in (
> select postcode from contact where postcode like 'OX6%'
> union all
> select postcode from contact where postcode like 'L1%'
> ...
> ...
> )
>
>Thanks,
>Jon
>R Fray wrote:
>
>> Hi,
>>
>> How can I include a wild card match when using the 'IN' clause? Ie, I
>> am wanting to pull out a list of addresses depending on the postcode.
>>
>> select * from contact where postcode in ('OX6 3NZ', 'OX6 3AZ', etc..)
>>
>> would work, but what I want to do is :
>>
>> select * from contact where postcode in ( like 'OX6%', like 'L1%',
>> etc..)
>>
>> Ie, so I can pull out a lot of postcodes without having to define them
>> all specifically. Is it possible to combine 'IN' and 'LIKE'? Or do I
>> have to use 750 'where' clauses :)
>>
>> Please cc replies to 'russ_at_u-net.net'
>>
>> Thanks in anticipation,
>> Russell.
>>
>> --
>>
>> Russell Fray
>> U-NET Ltd.
>
>
>
Received on Mon Sep 28 1998 - 17:31:20 CDT

Original text of this message

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