<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forum PostgreSQL - Numerowanie/ iterowanie wierszy tabeli]]></title>
	<link rel="self" href="http://forum.postgresql.org.pl/extern.php?action=feed&amp;tid=1888&amp;type=atom"/>
	<updated>2013-10-02T11:02:49Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.postgresql.org.pl/viewtopic.php?id=1888</id>
		<entry>
			<title type="html"><![CDATA[Odp: Numerowanie/ iterowanie wierszy tabeli]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=4736#p4736"/>
			<content type="html"><![CDATA["window functions", row_number(), dense_rank(), ...
- dzięki :-)]]></content>
			<author>
				<name><![CDATA[tomek]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1459</uri>
			</author>
			<updated>2013-10-02T11:02:49Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=4736#p4736</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: Numerowanie/ iterowanie wierszy tabeli]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=4728#p4728"/>
			<content type="html"><![CDATA[select termin,row_number() over (order by termin) as lp,
row_number() over (PARTITION BY to_char(termin,'YYYY') ORDER BY termin) as na_raty
from tabela]]></content>
			<author>
				<name><![CDATA[adamleon]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=873</uri>
			</author>
			<updated>2013-10-01T11:14:18Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=4728#p4728</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: Numerowanie/ iterowanie wierszy tabeli]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=4727#p4727"/>
			<content type="html"><![CDATA[poczytaj o "Window functions", a dokładnie o row_number()]]></content>
			<author>
				<name><![CDATA[c_michal]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=627</uri>
			</author>
			<updated>2013-10-01T11:04:15Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=4727#p4727</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Numerowanie/ iterowanie wierszy tabeli]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=4725#p4725"/>
			<content type="html"><![CDATA[Mam tabele:

termin
----------------
2011-03-15
2011-06-15
2011-09-15
2011-12-15

2012-03-15
2012-06-15
2012-12-15

2013-02-15
2013-05-15
2013-08-15
2013-11-15
2013-12-30


---------------------------------------------
1.
Chciałbym uzyskać taką tabelę

termin         | lp
----------------------------
2011-03-15 | 1
2011-06-15 | 2
2011-09-15 | 3
2011-12-15 | 4

2012-03-15 | 5
2012-06-15 | 6
2012-12-15 | 7

2013-02-15 | 8
2013-05-15 | 9
2013-08-15 | 10
2013-11-15 | 11
2013-12-30 | 12


------------------------------------------
2.
Chciałbym uzyskać taką tabelę:


termin         | nr_raty
----------------------------
2011-03-15 | 1
2011-06-15 | 2
2011-09-15 | 3
2011-12-15 | 4

2012-03-15 | 1
2012-06-15 | 2
2012-12-15 | 3

2013-02-15 | 1
2013-05-15 | 2
2013-08-15 | 3
2013-11-15 | 4
2013-12-30 | 5



Proszę o wskazówki, nie wiem za bardzo jak do tego podejść.]]></content>
			<author>
				<name><![CDATA[tomek]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1459</uri>
			</author>
			<updated>2013-10-01T09:26:09Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=4725#p4725</id>
		</entry>
</feed>
