On Tue, 27 Feb 2001, Herbert Ambos wrote:

> I'm trying to create Domain Aggregate function that mimic Access' Dlookup
> function, but without any luck, after digging (i think) all the docs
> don't have the solution yet.
> 
> Syntax:
> 
>       DLookup ('field', 'table|view', ['condition'])
> 
>       where:
>       field --               column name or calculation
>         table|view --
>       condition (optional) -- SQL WHERE condition without the
>                               WHERE keyword
>       
>       If the query returns multiple rows then it will only get the
>       topmost column.
>       If the query retuns 0 rows then NULL would be returned
> 
> 
> An example argument to the function would be
> 
>       DLookup ('id', 'student', 'name=\'Bill Gates\'') --> '2001-432'

Is this supposed to give effectively the same result as the subquery 
(select student.id where name='Bill Gates' limit 1)?  I don't think
that subquery is supported in 7.0, but will be in 7.1 along with 
EXECUTE for plpgsql which should let you build a query out of the
parts you give it.  I think you'd possibly be able to do this in 7.0 
using pltcl but I don't know tcl so I can't help there.

Reply via email to