Re: How to get joins to work

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: How to get joins to work
Дата
Msg-id 20061024220430.GI30158@svana.org
обсуждение исходный текст
Ответ на How to get joins to work  (Bill Ewing <wrewing001@yahoo.com>)
Список pgsql-general
On Tue, Oct 24, 2006 at 02:43:07PM -0700, Bill Ewing wrote:
> I am having trouble getting joins to work.  In a Java app that uses Hibernate 3.1, I am able to build queries that
jointwo, three or more tables using combinations of INNER JOIN,  LEFT JOIN or RIGHT JOIN.  But, I need FULL OUTER JOIN
towork and have not been able to get them to work in Hibernate. 
>
> So I decided to go back to basics and practice trial joins in the PgAdminIII Query tool (v1.4.1, Dec 05).
>
> Just to warm up, I did the following simple queries which all worked:
>   select * FROM rack r
>   select * FROM sample s
>
> 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

These statements are incomplete. You need to say what you're joining
on. For example:

select * FROM rack r JOIN sample s USING (joinfield)

or
select * FROM rack r JOIN sample s ON (r.a = s.b);

If you really don't want any constraints, use a comma, or a cross join

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

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

Предыдущее
От: "Magnus Hagander"
Дата:
Сообщение: Re: 8.2beta1 installation fails
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: benchmark suite