<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forum PostgreSQL - Pobieranie z jednego pola]]></title>
	<link rel="self" href="http://forum.postgresql.org.pl/extern.php?action=feed&amp;tid=1338&amp;type=atom"/>
	<updated>2012-05-17T13:18:01Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.postgresql.org.pl/viewtopic.php?id=1338</id>
		<entry>
			<title type="html"><![CDATA[Odp: Pobieranie z jednego pola]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=3609#p3609"/>
			<content type="html"><![CDATA[Dzięki poradziłem sobie inaczej:

[code]
SELECT tabela.ID, temp1.KOD, temp2.KOD
FROM slownik AS temp1,
   slownik AS temp2
WHERE
temp1.KOD = tabela.dane_1 AND
temp2.KOD = tabela.dane_2
[/code]

Dzięki za odpowiedzi.]]></content>
			<author>
				<name><![CDATA[lasoty]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1424</uri>
			</author>
			<updated>2012-05-17T13:18:01Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=3609#p3609</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: Pobieranie z jednego pola]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=3605#p3605"/>
			<content type="html"><![CDATA[lub tak gdy dana_1 lub dana_2 będą przechowywały wartość null
Select t1.dane_1,(select kod from slownik where id= t1.dane_1) as kod_1 ,t1.dane_2,(select kod from slownik where id= t1.dane_2) as kod_2
from tabela t1]]></content>
			<author>
				<name><![CDATA[c_michal]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=627</uri>
			</author>
			<updated>2012-05-16T10:59:06Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=3605#p3605</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: Pobieranie z jednego pola]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=3604#p3604"/>
			<content type="html"><![CDATA[O takie cusik chodziło ??

Select t1.dane_1,s1.kod,t1.dane_2,s2.kod
from tabela t1
join slownik s1 on s1.id = t1.dane_1
join slownik s2 on s2.id = t1.dane_2;]]></content>
			<author>
				<name><![CDATA[adamleon]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=873</uri>
			</author>
			<updated>2012-05-16T05:21:25Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=3604#p3604</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Pobieranie z jednego pola]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=3603#p3603"/>
			<content type="html"><![CDATA[Witam, mam dwie tabele:

[code]
+-----------+
|  tabela   |
+-----------+
|  ID       |
+-----------+
| dane_1    |
+-----------+
| dane_2    |
+-----------+

-----------------------------
+-----------+
|  slownik  |
+-----------+
|  ID       |
+-----------+
| KOD       |
+-----------+
| opis      |
+-----------+
[/code]

Problem polega na tym, że pola dane_1 oraz dane_2 odnoszą się do pola slownik.ID. Jak powinno wyglądać zapytanie aby poprawnie wyświetlić wartość pola slownik.KOD do którego odnoszą się wspomniane pola?]]></content>
			<author>
				<name><![CDATA[lasoty]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1424</uri>
			</author>
			<updated>2012-05-15T22:14:20Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=3603#p3603</id>
		</entry>
</feed>
