Re: DLookup('field', 'table', ['condition']) - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: DLookup('field', 'table', ['condition'])
Date
Msg-id Pine.BSF.4.21.0102262021570.34291-100000@megazone23.bigpanda.com
Whole thread Raw
In response to DLookup('field', 'table', ['condition'])  (Herbert Ambos <herbert@hindang.msuiit.edu.ph>)
List pgsql-sql
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.



pgsql-sql by date:

Previous
From: Herbert Ambos
Date:
Subject: DLookup('field', 'table', ['condition'])
Next
From: "postgresql"
Date:
Subject: underscore problem