<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Forum PostgreSQL - Nietypowe zlaczenie dwoch tabel]]></title>
		<link>https://forum.postgresql.org.pl/viewtopic.php?id=575</link>
		<description><![CDATA[Najświeższe odpowiedzi w Nietypowe zlaczenie dwoch tabel.]]></description>
		<lastBuildDate>Thu, 21 Apr 2011 10:46:18 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Odp: Nietypowe zlaczenie dwoch tabel]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=2481#p2481</link>
			<description><![CDATA[rozwiazalem ten problem przy pomocy uni


select id,login,host,date from clock where id not in (select old_id from events) 
union
select old_id as id,login,host,date_old as date from events
order by id]]></description>
			<author><![CDATA[dummy@example.com (awers)]]></author>
			<pubDate>Thu, 21 Apr 2011 10:46:18 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=2481#p2481</guid>
		</item>
		<item>
			<title><![CDATA[Odp: Nietypowe zlaczenie dwoch tabel]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=2480#p2480</link>
			<description><![CDATA[Co?

Może jakiś konkretny przykład co chcesz osiągnąć.]]></description>
			<author><![CDATA[dummy@example.com (rski)]]></author>
			<pubDate>Wed, 20 Apr 2011 18:13:00 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=2480#p2480</guid>
		</item>
		<item>
			<title><![CDATA[Nietypowe zlaczenie dwoch tabel]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=2479#p2479</link>
			<description><![CDATA[Witam

Mam 2 tabele 

1 

CREATE TABLE clock
(
  id integer NOT NULL DEFAULT nextval('test_id_seq'::regclass),
  "login" text,
  host text,
  "domain" text,
  status smallint,
  date timestamp without time zone DEFAULT now(),
  CONSTRAINT test_pkey PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);

oraz 2

CREATE TABLE events
(
  id serial NOT NULL,
  "login" text,
  host text,
  "domain" text,
  status smallint,
  date timestamp without time zone DEFAULT now(),
  date_old timestamp without time zone,
  date_new timestamp without time zone,
  env text,
  old_id integer,
  CONSTRAINT env_test_pkey PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);


w tabeli event sa wpisywane zmiany czasu wartosci clock.date z tabeli clock.

Chcialbym uzyskac zapytanie ktore wstawia daty wartosci z pola event.date_old, tabele maja relacje jeden do wielu po przez clock.id -> event.old_id.

Czy ktos ma pomysl jak to rozwiac?]]></description>
			<author><![CDATA[dummy@example.com (awers)]]></author>
			<pubDate>Wed, 20 Apr 2011 14:51:25 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=2479#p2479</guid>
		</item>
	</channel>
</rss>
