Re: DLookup('field', 'table', ['condition'])

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Herbert Ambos <herbert(at)hindang(dot)msuiit(dot)edu(dot)ph>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: DLookup('field', 'table', ['condition'])
Date: 2001-02-27 04:27:37
Message-ID: Pine.BSF.4.21.0102262021570.34291-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Herbert Ambos 2001-02-27 12:20:01 DLookup('field', 'table', ['condition'])
Previous Message Jie Liang 2001-02-26 21:07:15 Re: Urgent help