<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forum PostgreSQL - zapytanie sqlowe z dwóch tabel]]></title>
	<link rel="self" href="http://forum.postgresql.org.pl/extern.php?action=feed&amp;tid=1365&amp;type=atom"/>
	<updated>2012-07-24T17:23:53Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.postgresql.org.pl/viewtopic.php?id=1365</id>
		<entry>
			<title type="html"><![CDATA[Odp: zapytanie sqlowe z dwóch tabel]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=3674#p3674"/>
			<content type="html"><![CDATA[select m.id,m.imie,m.nazwisko, m.pesel, m.adres,count(s.id) as ilosc_samochodow
from mieszkaniec m
left join samochod s on m.id=s.mieszkaniec_id
group by m.id,m.imie,m.nazwisko, m.pesel, m.adres

to zapytanie pokarze Ci wszystkich mieszkańców z informacja ile maja samochodów ale jeśli chcesz pokazać tylko tych którzy mają np 4 trzeba na końcu dopisać having count(s.id)=4]]></content>
			<author>
				<name><![CDATA[c_michal]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=627</uri>
			</author>
			<updated>2012-07-24T17:23:53Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=3674#p3674</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[zapytanie sqlowe z dwóch tabel]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=3672#p3672"/>
			<content type="html"><![CDATA[Witam,

Potrzebuje Waszej pomocy. Mam dwie tabele
mieszkaniec z kolumnami
id,imie,nazwisko, pesel, adres

 i samochod
id,typ,model,mieszkaniec_id

Musze napisać zapytanei liczące, ilu jest miszkańców którzy mają2 samochody, 3 samochody i 4 samochody.
czy macie pomysł jak to rozpisać?]]></content>
			<author>
				<name><![CDATA[mkarach]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1197</uri>
			</author>
			<updated>2012-07-24T07:00:57Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=3672#p3672</id>
		</entry>
</feed>
