Re: libpq++: how do I qualify by table name a resulting field when there are duplicate field names

From: Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk>
To: Nicolae <nick(at)strongholdtech(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: libpq++: how do I qualify by table name a resulting field when there are duplicate field names
Date: 2001-03-21 23:43:08
Message-ID: 20010321234308.P1479@quartz.newn.cam.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Mar 21, 2001 at 10:59:41AM -0500, Nicolae wrote:
...
> SELECT * FROM customers, deals WHERE customers.number = deals.customernumber
> AND customers.number = 1;
>
> When I do
>
> database->GetValue (0, "number");
>
> I get back the number field of the customer table.
>
> But I want the number field from the deal table too.
> How do I get it?
>
> database->GetValue (0, "deals.number")
>
> gives me an error.

How about

SELECT customers.number,deals.number FROM customers,deals
WHERE customers.number = deals.customernumber
AND customers.number = 1

database->GetValue(0,0) (I think it starts at 0..) == customers.number
database->GetValue(0,1) == deals.number

?

Cheers,

Patrick

In response to

Browse pgsql-general by date

  From Date Subject
Next Message mjbjr 2001-03-21 23:50:03 regress test errors
Previous Message Vince Vielhaber 2001-03-21 23:42:05 Re: hang on (was: New Book: PostgreSQL: The Elephant Never Forgets)