pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: SQL a simple menu - plz help
3+ messages / 2 participants
[nested] [flat]

* Re: SQL a simple menu - plz help
@ 2003-11-23 16:51  Randolf Richardson, DevNet SysOp 29 <rr@8x.ca>
  0 siblings, 1 reply; 3+ messages in thread

From: Randolf Richardson, DevNet SysOp 29 @ 2003-11-23 16:51 UTC (permalink / raw)
  To: pgsql-sql

> As subj says. A simple menu is defined in a table. But how to extract
> it? Heres the deal:
> 
> Table menu has these 3 columns: menuid    parent    menudesc
> 
> Ok this should be easy right? Those menu-rows that has parent=0 is
> "toplevel". And so forth. An example:
> 
> 1    0    "Items"
> 2    0    "Standings"
> 3    0    "Test"
> 4    2    "Liverpool"
> 5    2    "AC Milan"
> 6    1    "Itemno1"
> 
> This menu should in layout come in this order:
> 
> Items
>     Itemno1
> Test
> Standings
>     AC Milan
>     Liverpool
> 
> That is: Alphabetically sorted and with the children underneath the
> parents. Right? Yes - and selecting the menu and doing some gymnastics
> in ASP isnt that hard. But ASP must be the language that has the
> "crapiest" way of handling arrays...so a simple task is really messy.
> Creating a stored procedure involes 2-3 temporary tables as I see it.
> Not vey elegant either. 
> 
> So my question is: Isnt there any way of selecting this order directly
> using SQL?? Some nice clean and beautiful way?

    	You're in need of the "CONNECT BY" option which is ideal for scenarios 
such as yours.  Unfortunately PostgreSQL doesn't have it yet, but I believe 
there is a PLSQL script (or something like this) which emulates the CONNECT 
BY behaviour and it's called "connectby()" or something like that.

-- 
Randolf Richardson - rr@8x.ca
Inter-Corporate Computer & Network Services, Inc.
Vancouver, British Columbia, Canada
http://www.8x.ca/

This message originated from within a secure, reliable,
high-performance network ... a Novell NetWare network.




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

* Re: SQL a simple menu - plz help
@ 2003-11-23 23:18  Randolf Richardson, DevNet SysOp 29 <rr@8x.ca>
  parent: Randolf Richardson, DevNet SysOp 29 <rr@8x.ca>
  0 siblings, 1 reply; 3+ messages in thread

From: Randolf Richardson, DevNet SysOp 29 @ 2003-11-23 23:18 UTC (permalink / raw)
  To: pgsql-sql

>>     You're in need of the "CONNECT BY" option which is ideal for
>> scenarios such as yours.  Unfortunately PostgreSQL doesn't have it
>> yet, but I believe there is a PLSQL script (or something like this)
>> which emulates the CONNECT BY behaviour and it's called "connectby()"
>> or something like that.
> 
> Thanks...Ill look into that.

    	Here, this link should help:

    	    	Search PostgreSQL - Opera
    	    	http://www.postgresql.org/search.cgi?q=connectby

-- 
Randolf Richardson - rr@8x.ca
Inter-Corporate Computer & Network Services, Inc.
Vancouver, British Columbia, Canada
http://www.8x.ca/

This message originated from within a secure, reliable,
high-performance network ... a Novell NetWare network.




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

* Re: SQL a simple menu - plz help
@ 2003-11-28 04:37  Randolf Richardson <rr@8x.ca>
  parent: Randolf Richardson, DevNet SysOp 29 <rr@8x.ca>
  0 siblings, 0 replies; 3+ messages in thread

From: Randolf Richardson @ 2003-11-28 04:37 UTC (permalink / raw)
  To: pgsql-sql

>>     Here, this link should help:
>>
>>         Search PostgreSQL - Opera
>>         http://www.postgresql.org/search.cgi?q=connectby
> 
> Thanks...rtfm I know :)

    	RTFM?  Oh, yeah, that's right -- Read The /FUNNY/ Manual!  =D

-- 
Randolf Richardson - rr@8x.ca
Vancouver, British Columbia, Canada

Please do not eMail me directly when responding
to my postings in the newsgroups.



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


end of thread, other threads:[~2003-11-28 04:37 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-23 16:51 Re: SQL a simple menu - plz help Randolf Richardson, DevNet SysOp 29 <rr@8x.ca>
2003-11-23 23:18 ` Randolf Richardson, DevNet SysOp 29 <rr@8x.ca>
2003-11-28 04:37   ` Randolf Richardson <rr@8x.ca>

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