interval query.

Поиск
Список
Период
Сортировка
Искать

interval query.

От:
Antti Linno <alligator@all.ee>
Дата:
Good morning.

Is there some way to make interval query? 

Towns table(estonia towns, heh :P)

id | name

1	Elva
2	Tartu
9999	Tallinn
3	Tallinn/Haabersti
4	Tallinn/Mustamae...
etc.

What I need is when the town's id=9999 I want to make query
where id=9999 OR id=[3..12] for example. I could generate bunch of OR's
like id=3 OR id=4 ... but is there some more elegant solution?


Greetings,Antti



Re: interval query.

От:
Blaise Carrupt <bc@mjtsa.com>
Дата:
> Is there some way to make interval query? 
> 
> What I need is when the town's id=9999 I want to make query
> where id=9999 OR id=[3..12] for example. I could generate bunch of OR's
> like id=3 OR id=4 ... but is there some more elegant solution?
> 

This should work : WHERE id = 9999 OR id BETWEEN(3 AND 12).

Regards


______________
B. Carrupt

Re: interval query.

От:
Mark Volpe <volpe.mark@epamail.epa.gov>
Дата:
Try

SELECT * FROM Towns WHERE id=9999 OR id BETWEEN 3 AND 12


Antti Linno wrote:
> 
> Good morning.
> 
> Is there some way to make interval query?
> 
> Towns table(estonia towns, heh :P)
> 
> id | name
> 
> 1       Elva
> 2       Tartu
> 9999    Tallinn
> 3       Tallinn/Haabersti
> 4       Tallinn/Mustamae
>         ...
> etc.
> 
> What I need is when the town's id=9999 I want to make query
> where id=9999 OR id=[3..12] for example. I could generate bunch of OR's
> like id=3 OR id=4 ... but is there some more elegant solution?
> 
> Greetings,
>         Antti

Re: interval query.

От:
Jie Liang <jliang@ipinc.com>
Дата:

Hi,

where id=9999 or id between 3 and 12;

or

where id in (3,4,5,6,7,8,9,10,11,12,9999);

Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.ipinc.com

On Wed, 31 Jan 2001, Antti Linno wrote:

> Good morning.
> 
> Is there some way to make interval query? 
> 
> Towns table(estonia towns, heh :P)
> 
> id | name
> 
> 1	Elva
> 2	Tartu
> 9999	Tallinn
> 3	Tallinn/Haabersti
> 4	Tallinn/Mustamae
> 	...
> etc.
> 
> What I need is when the town's id=9999 I want to make query
> where id=9999 OR id=[3..12] for example. I could generate bunch of OR's
> like id=3 OR id=4 ... but is there some more elegant solution?
> 
> 
> Greetings,
> 	Antti
> 
> 


FAQ