pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
interval query.
4+ messages / 4 participants
[nested] [flat]

* interval query.
@ 2001-01-31 09:43 Antti Linno <alligator@all.ee>
  2001-01-31 15:10 ` Re: interval query. Mark Volpe <volpe.mark@epamail.epa.gov>
  2001-01-31 17:48 ` Re: interval query. Jie Liang <jliang@ipinc.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Antti Linno @ 2001-01-31 09:43 UTC (permalink / raw)
  To: pgsql-sql

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





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: interval query.
  2001-01-31 09:43 interval query. Antti Linno <alligator@all.ee>
@ 2001-01-31 15:10 ` Mark Volpe <volpe.mark@epamail.epa.gov>
  1 sibling, 0 replies; 4+ messages in thread

From: Mark Volpe @ 2001-01-31 15:10 UTC (permalink / raw)
  To: Antti Linno <alligator@all.ee>; +Cc: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: interval query.
  2001-01-31 09:43 interval query. Antti Linno <alligator@all.ee>
@ 2001-01-31 17:48 ` Jie Liang <jliang@ipinc.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Jie Liang @ 2001-01-31 17:48 UTC (permalink / raw)
  To: Antti Linno <alligator@all.ee>; +Cc: pgsql-sql


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
> 
> 




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: interval query.
@ 2001-01-31 12:06 Blaise Carrupt <bc@mjtsa.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Blaise Carrupt @ 2001-01-31 12:06 UTC (permalink / raw)
  To: pgsql-sql

> 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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2001-01-31 17:48 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-01-31 09:43 interval query. Antti Linno <alligator@all.ee>
2001-01-31 15:10 ` Mark Volpe <volpe.mark@epamail.epa.gov>
2001-01-31 17:48 ` Jie Liang <jliang@ipinc.com>
2001-01-31 12:06 Re: interval query. Blaise Carrupt <bc@mjtsa.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox