<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forum PostgreSQL - Nietypowe zlaczenie dwoch tabel]]></title>
	<link rel="self" href="http://forum.postgresql.org.pl/extern.php?action=feed&amp;tid=575&amp;type=atom"/>
	<updated>2011-04-21T10:46:18Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.postgresql.org.pl/viewtopic.php?id=575</id>
		<entry>
			<title type="html"><![CDATA[Odp: Nietypowe zlaczenie dwoch tabel]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=2481#p2481"/>
			<content type="html"><![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]]></content>
			<author>
				<name><![CDATA[awers]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1226</uri>
			</author>
			<updated>2011-04-21T10:46:18Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=2481#p2481</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: Nietypowe zlaczenie dwoch tabel]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=2480#p2480"/>
			<content type="html"><![CDATA[Co?

Może jakiś konkretny przykład co chcesz osiągnąć.]]></content>
			<author>
				<name><![CDATA[rski]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=26</uri>
			</author>
			<updated>2011-04-20T18:13:00Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=2480#p2480</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Nietypowe zlaczenie dwoch tabel]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=2479#p2479"/>
			<content type="html"><![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?]]></content>
			<author>
				<name><![CDATA[awers]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1226</uri>
			</author>
			<updated>2011-04-20T14:51:25Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=2479#p2479</id>
		</entry>
</feed>
