pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bradley Miller <bmiller@nuvio.com>
To: pgsql-sql@postgresql.org
Subject: URGENT:  Using function inside query
Date: Tue, 18 Jan 2005 14:51:01 -0600
Message-ID: <A94BADA0-6992-11D9-BEEF-000D932ED682@nuvio.com> (raw)

I need some help on the following problem.  I have an account info 
table that has a hierarchy of accounts.  The grouping goes from end 
user to organization to reseller.  I have a PL/SQL function written 
that gives me the tree, so I just whittle it down by selecting the one 
id for a reseller:

select account_id from roll_account(1186) where hierarchy_type_id = 2


The problem is I have data like this:

account id    name

1    Company A
2    Company B
3    Company C
4    Person 1 (in Company A)
5    Person 2 (in Company A)

If I pass it the number of let's say Person 2 -- the above query wold 
give me the account id of 1.    How can I do a query using that 
function so that it automatically inserts the account_id to show the 
"rolled up" account id ?


Bradley Miller
NUVIO CORPORATION
Phone: 816-444-4422 ext. 6757
Fax: 913-498-1810
http://www.nuvio.com
bmiller@nuvio.com

view thread (2+ messages)  latest in thread

Message-ID: <A94BADA0-6992-11D9-BEEF-000D932ED682@nuvio.com>
Permalink:  ../A94BADA0-6992-11D9-BEEF-000D932ED682@nuvio.com/
Also on:    postgresql.org/message-id/A94BADA0-6992-11D9-BEEF-000D932ED682@nuvio.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bmiller@nuvio.com
  Subject: Re: URGENT:  Using function inside query
  In-Reply-To: <A94BADA0-6992-11D9-BEEF-000D932ED682@nuvio.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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