From: Michael Fuhr <mike@fuhr.org>
To: Bradley Miller <bmiller@nuvio.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: URGENT: Using function inside query
Date: Tue, 18 Jan 2005 23:39:19 -0700
Message-ID: <20050119063918.GA57167@winnie.fuhr.org> (raw)
In-Reply-To: <A94BADA0-6992-11D9-BEEF-000D932ED682@nuvio.com>
References: <A94BADA0-6992-11D9-BEEF-000D932ED682@nuvio.com>
On Tue, Jan 18, 2005 at 02:51:01PM -0600, Bradley Miller wrote:
> 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 ?
I'm not sure I follow -- what account_id are you trying to insert
and where are you trying to insert it? Do you want something like
this?
SELECT account_id
FROM roll_account(
(SELECT account_id FROM account_info WHERE name = 'Person 2')
)
WHERE hierarchy_type_id = 2;
If that's not what you're after then please provide an example of
the kind of query you'd like to make and what results you expect.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
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: mike@fuhr.org, bmiller@nuvio.com
Subject: Re: URGENT: Using function inside query
In-Reply-To: <20050119063918.GA57167@winnie.fuhr.org>
* 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