Re: How to get joins to work

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: How to get joins to work
Дата
Msg-id 9B71F9ED-2A64-4F95-80BE-556751110AE6@seespotcode.net
обсуждение исходный текст
Ответ на How to get joins to work  (Bill Ewing <wrewing001@yahoo.com>)
Ответы Re: How to get joins to work  ("Anonymous" <anonymous.nospam@hotmail.com>)
Список pgsql-general
On Oct 25, 2006, at 6:43 , Bill Ewing wrote:

> The above two tables are linked.  But, none of the following SQL
> worked:
>   select * FROM rack r JOIN sample s
>   select * FROM rack r INNER JOIN sample s
>
>
> In each case I get a message "ERROR:  syntax error at end of input
> at character X" where X is the last character in the statement.
>
> What am I doing wrong?

Unless you're using NATURAL JOIN, you need to specify the join
condition using a USING or ON clause, e.g.,

SELECT *
FROM rack r
JOIN sample s USING (rack_id)

or

SELECT *
FROM rack r
JOIN sample s ON (r.rack_id = s.rack_id)

That should do it.

Michael Glaesemann
grzm seespotcode net



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

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: [pgsql-advocacy] Call for Donations
Следующее
От: "Harald Armin Massa"
Дата:
Сообщение: Re: 8.2beta1 installation fails