pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Volker Krebs <volker.krebs@abas.de>
To: pgsql-sql@postgresql.org
Subject: Language dependent fields
Date: Tue, 15 Aug 2000 10:43:06 +0200
Message-ID: <3999029A.1E39AAAB@abas.de> (raw)

Hi,

I want the content of a field to be language dependent.

Therfore we have a Translation table which looks like this:

tln_id  tln_lng_id      tln_text
---------------------------------
1       de              hallo
1       en              hello
2       de              Herr
2       en              Mister

any language dependent fields reference to this table e.g.

table customer

cst_id  cst_sometext_tln_id
----------------------------
1000    1

I've created a view to get the text:

CREATE VIEW locale_customer AS
SELECT customer.*, tln_text, tln_lng_id FROM customer,translation
WHERE tln_id=cst_sometext_tln_id;

this works fine for tables with only one language dependent field.
But if I have more than one field I've got a problem.

e.g.

table customer2

cst_id  cst_sometext_tln_id     cst_sometext2_tln_id
----------------------------------------------------
1000    1                       2

how can I create a proper view, to get both tln_text fields ??

CREATE VIEW locale_customer2 AS
SELECT customer2.*, tln_text, tln_lng_id FROM customer,translation
WHERE tln_id=cst_sometext_tln_id OR tln_id=cst_sometext2_tln_id;
gives me all tln_text fields, but I can't distinguish between them.

Any help appriciated.

thanks
Volker



view thread (2+ messages)  latest in thread

Message-ID: <3999029A.1E39AAAB@abas.de>
Permalink:  ../3999029A.1E39AAAB@abas.de/
Also on:    postgresql.org/message-id/3999029A.1E39AAAB@abas.de

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: volker.krebs@abas.de
  Subject: Re: Language dependent fields
  In-Reply-To: <3999029A.1E39AAAB@abas.de>
  References: <3999029A.1E39AAAB@abas.de>

* 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