pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
selecting from integer[]
3+ messages / 3 participants
[nested] [flat]

* selecting from integer[]
@ 2002-06-29 11:48 Kelly <quadratini@sni.ph>
  2002-06-29 14:32 ` Re: selecting from integer[] Christopher Kings-Lynne <chriskl@familyhealth.com.au>
  2002-06-29 21:11 ` Re: selecting from integer[] Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Kelly @ 2002-06-29 11:48 UTC (permalink / raw)
  To: pgsql-sql


select * from pg_user where usesysid=(select grolist[1] from pg_group 
where groname='mygroup');
select * from pg_user where usesysid=(select grolist[2] from pg_group 
where groname='mygroup');
select * from pg_user where usesysid=(select grolist[3] from pg_group 
where groname='mygroup');

Can those three queries be merged to one query? (and still gives me 
those three rows)
Or do I have to explicitly say grolist[1], grolist[2], etc....

Thanks in advance :)






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

* Re: selecting from integer[]
  2002-06-29 11:48 selecting from integer[] Kelly <quadratini@sni.ph>
@ 2002-06-29 14:32 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
  1 sibling, 0 replies; 3+ messages in thread

From: Christopher Kings-Lynne @ 2002-06-29 14:32 UTC (permalink / raw)
  To: Kelly <quadratini@sni.ph>; +Cc: pgsql-sql

Well, you can always just UNION them - I don't know if there's a better
way tho.

select * from ...
union [all]
select * from ...
union [all]
select * from ...;

Chris


On Sat, 29 Jun 2002, Kelly wrote:

>
> select * from pg_user where usesysid=(select grolist[1] from pg_group
> where groname='mygroup');
> select * from pg_user where usesysid=(select grolist[2] from pg_group
> where groname='mygroup');
> select * from pg_user where usesysid=(select grolist[3] from pg_group
> where groname='mygroup');
>
> Can those three queries be merged to one query? (and still gives me
> those three rows)
> Or do I have to explicitly say grolist[1], grolist[2], etc....
>
> Thanks in advance :)
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
>






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

* Re: selecting from integer[]
  2002-06-29 11:48 selecting from integer[] Kelly <quadratini@sni.ph>
@ 2002-06-29 21:11 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Stephan Szabo @ 2002-06-29 21:11 UTC (permalink / raw)
  To: Kelly <quadratini@sni.ph>; +Cc: pgsql-sql

On Sat, 29 Jun 2002, Kelly wrote:

> select * from pg_user where usesysid=(select grolist[1] from pg_group
> where groname='mygroup');
> select * from pg_user where usesysid=(select grolist[2] from pg_group
> where groname='mygroup');
> select * from pg_user where usesysid=(select grolist[3] from pg_group
> where groname='mygroup');
>
> Can those three queries be merged to one query? (and still gives me
> those three rows)
> Or do I have to explicitly say grolist[1], grolist[2], etc....

If you want to do "is element in array," I believe the array iterator
functions in contrib/array might help you.






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


end of thread, other threads:[~2002-06-29 21:11 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-06-29 11:48 selecting from integer[] Kelly <quadratini@sni.ph>
2002-06-29 14:32 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2002-06-29 21:11 ` Stephan Szabo <sszabo@megazone23.bigpanda.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