JOIN on a lookup table

Поиск
Список
Период
Сортировка
От Keith Worthington
Тема JOIN on a lookup table
Дата
Msg-id 20050406195940.M32089@narrowpathinc.com
обсуждение исходный текст
Ответы Re: JOIN on a lookup table  (Keith Worthington <KeithW@NarrowPathInc.com>)
Re: JOIN on a lookup table  ("Luiz K. Matsumura" <luiz@planit.com.br>)
Список pgsql-novice
Hi All,

I am working on a view that needs to join a table that holds lookup
information.  It is a fairly simple id vs name relationship.  How can I get
the different names I am looking for?  Below is what I have for a query so far
but obviously it isn't working.  Any hints will be appreciated.

   SELECT tbl_item.id                   AS item_id,
          tbl_item.sales_gl_account     AS acct_sales_gl_nmbr,
          tbl_gl_account.description    AS acct_sales_gl_name,
          tbl_item.inventory_gl_account AS acct_inv_gl_nmbr,
          tbl_gl_account.description    AS acct_inv_gl_name,
          tbl_item.cogs_gl_account      AS acct_cogs_gl_nmbr,
          tbl_gl_account.description    AS acct_cogs_gl_name
     FROM tbl_item
     JOIN tbl_gl_account
       ON ( account_id = sales_gl_account AND
            account_id = inventory_gl_account AND
            account_id = cogs_gl_account )
  ORDER BY tbl_item.id;

Kind Regards,
Keith

В списке pgsql-novice по дате отправления:

Предыдущее
От: Deepblues
Дата:
Сообщение: binding values to sql statement in DBI perl
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: binding values to sql statement in DBI perl