SQL-question (JOIN)
От | pilsl@goldfisch.at |
---|---|
Тема | SQL-question (JOIN) |
Дата | |
Msg-id | 20030131212051.GI14689@goldfisch.at обсуждение исходный текст |
Ответы |
Re: SQL-question (JOIN)
Re: SQL-question (JOIN) Re: SQL-question (JOIN) Re: SQL-question (JOIN) |
Список | pgsql-general |
not sure if such question are on-topic here. (where would this question be on-topic ?) I need to join two tables with a logical "if-statement". If for a certain row in table1 there is a related row in table2, then take the row from table2 else take it from table1. The relation is a simple equal on one column. example: table1: uid | name ----+----- 1 | bob 2 | jim 3 | tom table2: uid | name ----+----- 2 | frank the final join should return: uid | name ----+----- 1 | bob 2 | frank 3 | tom I played around with joins and intersects and distincts but only ended up in complex unperformant queries that didnt do what I intended. I miss the basic idea how to solve this. thnx, peter -- mag. peter pilsl IT-Consulting tel: +43-699-1-3574035 fax: +43-699-4-3574035 pilsl@goldfisch.at http://www.goldfisch.at
В списке pgsql-general по дате отправления: