|
|||||||||||
|
Re: [GENERAL] Problem with joining two tables
From: A. Kretschmer <andreas.kretschmer(at)schollglas.com>
Date: Wed Dec 05 2007 - 09:02:08 EST
Okay, let's try: first i create your tables like above:
test=*# select * from t1;
1 | sth1 2 | sth2 3 | sth3 4 | sth4 5 | sth5 (5 rows)
test=*# select * from t2;
1 | desc1 | etc1
2 | desc2 | etc2
2 | desc3 | etc3
2 | desc4 | etc4
3 | desc5 | etc5
| desc6 | etc6
5 | desc7 | etc7
(7 rows) And now:
test=*# select t1.id, t1.stuff, t2.des, t2.etc from t1, t2 where t1.id=t2.id;
id | stuff | des | etc
1 | sth1 | desc1 | etc1 2 | sth2 | desc2 | etc2 2 | sth2 | desc3 | etc3 2 | sth2 | desc4 | etc4 3 | sth3 | desc5 | etc5 5 | sth5 | desc7 | etc7 (6 rows) is this your expected result? Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqReceived on Wed Dec 5 09:03:23 2007 This archive was generated by hypermail 2.1.8 : Mon Jun 16 2008 - 21:23:46 EDT |
||||||||||
|
|||||||||||