Quick join query

Поиск
Список
Период
Сортировка
От SG Edwards
Тема Quick join query
Дата
Msg-id 1114159990.4268bb7626a76@sms.ed.ac.uk
обсуждение исходный текст
Ответы Re: Quick join query  (Sean Davis <sdavis2@mail.nih.gov>)
Список pgsql-novice
Hi,

I have four tables which I wish to join into a view using the following code:

CREATE VIEW web_search AS
SELECT * FROM basic_search
LEFT JOIN comment USING (bioentry_id)
LEFT JOIN bioentry_reference USING (bioentry_id)
LEFT JOIN taxon_name USING (taxon_id);

I have two questions regarding this creation:

1. If I only want to join one column from the table "comment" rather than the
whole table, is there a way to do this with a create view statement? (comment
table has 4 columns Comment_id, Bioentry_id, Comment_text, Rank but I just want
comment_text to be joined to basic search).

2. The last join throws an error because a column in taxon_name has the same
name as one in basic search ("name"). Is there a way to change a column name
within the join statement?

Many thanks for your help,

Stephen

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

Предыдущее
От: "Pradeepkumar, Pyatalo (IE10)"
Дата:
Сообщение: Re: Disk full problem
Следующее
От: Sean Davis
Дата:
Сообщение: Re: Quick join query