<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Forum PostgreSQL - Pomoc w napisaniu selecta]]></title>
		<link>https://forum.postgresql.org.pl/viewtopic.php?id=1422</link>
		<description><![CDATA[Najświeższe odpowiedzi w Pomoc w napisaniu selecta.]]></description>
		<lastBuildDate>Thu, 29 Nov 2012 13:36:25 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Odp: Pomoc w napisaniu selecta]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3807#p3807</link>
			<description><![CDATA[można jeszcze tak, choć twój sposób jest bardzo dobry
select distinct x from tabela t where y=1 and exists (select 1 from tabela where x=t.x and y=2);
lub 
select distinct x from tabela t1 join tabela t2 on t1.x=t2.x and t2.y=2 where t1.y=1;

PS distinct dopisuje bo nie wiem czy zestaw danych x, y w tabeli jest unikatowy]]></description>
			<author><![CDATA[dummy@example.com (c_michal)]]></author>
			<pubDate>Thu, 29 Nov 2012 13:36:25 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3807#p3807</guid>
		</item>
		<item>
			<title><![CDATA[Odp: Pomoc w napisaniu selecta]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3806#p3806</link>
			<description><![CDATA[Chyba tak:

select x from tabela where y = 1 intersect select x from tabela where y =2

i to nam da iksy, a jak mamy iksy to już wyciągniemy i całe wiersze.]]></description>
			<author><![CDATA[dummy@example.com (tomek)]]></author>
			<pubDate>Thu, 29 Nov 2012 10:58:48 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3806#p3806</guid>
		</item>
		<item>
			<title><![CDATA[Pomoc w napisaniu selecta]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3805#p3805</link>
			<description><![CDATA[Mam taką tabelę:

X | Y
------

3   | 1
3   | 2

5   | 1

8   | 2

12 | 1
12 | 1

55 | 2
55 | 2

64 | 1
64 | 1
64 | 2



Chciałbym wybrać tylko takie wiersze:

3   |1
3   |2
bo mam X = 3, a dla niego dwie różne wartości Y

64 | 1
64 | 1
64 | 2
bo mam X = 64, a dla nich dwie różne wartości Y,


ale nie chcę wybierać wierszy:

5   | 1

8   | 2

12 | 1
12 | 1

55 | 2
55 | 2

bo przykładowo mam X = 55, ale tylko jedną wartość Y=2.

------------------------------

Jakiego selecta mam napisać ?
Proszę o pomoc.]]></description>
			<author><![CDATA[dummy@example.com (tomek)]]></author>
			<pubDate>Thu, 29 Nov 2012 09:10:06 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3805#p3805</guid>
		</item>
	</channel>
</rss>
