<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forum PostgreSQL - Pomoc w join-owaniu tabel]]></title>
	<link rel="self" href="http://forum.postgresql.org.pl/extern.php?action=feed&amp;tid=1489&amp;type=atom"/>
	<updated>2013-04-30T13:22:53Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.postgresql.org.pl/viewtopic.php?id=1489</id>
		<entry>
			<title type="html"><![CDATA[Odp: Pomoc w join-owaniu tabel]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=4168#p4168"/>
			<content type="html"><![CDATA[select * 
from b
left join a as a1 on a1.id=b.fk_1
left join a as a2 on a2.id=b.fk_2]]></content>
			<author>
				<name><![CDATA[c_michal]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=627</uri>
			</author>
			<updated>2013-04-30T13:22:53Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=4168#p4168</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Pomoc w join-owaniu tabel]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=4167#p4167"/>
			<content type="html"><![CDATA[Mam tabele
[code]A
    id
    ....[/code]

Oraz
[code]B
    ...
    fk_1          będąca foregin key do A.id
    fk_2          będąca foregin key do A.id[/code]

Jak napisać takiego selecta:

[code]select A.*, B.*
from B
    inner join A
        on B.fk_1 = A.id
    inner join A
        on B.fk_2 = A.id;[/code]
bo teraz dostaję error
[quote]BŁĄD:  nazwa tabeli "A" określona więcej niż raz[/quote]]]></content>
			<author>
				<name><![CDATA[tomek]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1459</uri>
			</author>
			<updated>2013-04-30T10:39:12Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=4167#p4167</id>
		</entry>
</feed>
