Beginner Join question
От | calvin@improtech.co.za (Calvin Browne) |
---|---|
Тема | Beginner Join question |
Дата | |
Msg-id | m0ylxUh-0012EcC@inlaw.improtech.co.za обсуждение исходный текст |
Ответы |
Re: [SQL] Beginner Join question
|
Список | pgsql-sql |
Been out of DB programming for a while, and am trying to get back in with postgres under Linux. Anyway, my question (should be fairly simple, but the manuals arn't quite clear) is as follows: TABLE A ( TABLE B( record_id record_id field1 field3 field2) field4) record_id in both tables are the same. The record definitely exists in TABLE A, but not necessarily in TABLE B. I need to get the following: record_id | A.field1 | A.field2 | B.field3 ------------------------------------------------------------------- rec1 | xxxx | xxxxxx | Field displayed if there is | | | a record in B, such that A.record_id | | | is equal to B.record.id, otherwise | | | leave it blank. ------------------------------------------------------------------- I'm going to have about a million records in each table, so efficiency of the join is a priority. Disk space is not. Thanks in advance. --Calvin -------------------| My opinions are mine |--------------------------------- Calvin Browne webmaster@improtech.co.za calvin@uniforum.org.za || Linux, NT, calvin@orange-tree.alt.za http://www.uniforum.org.za/~calvin |-|| Jeans, Page me via: http://www.uniforum.org.za/~calvin/page.html |--|| Sneakers & Phone: +27 11 805-1000 Fax: +27 11 805-4004 |------|| Talking Heads -------------| Gotta get this .sig shorter :) |-----------------------------
В списке pgsql-sql по дате отправления: