2012-02-22 2 views
0

から絡み合っ値が、私は存在するいずれか、またはweather.citycity.nameのいずれかから値を1列のみcity_nameを得るよう*の代わりに何を書くべきですか?フル外部結合 - 純粋な教育目的のために結合された列

flav=# select * from weather full outer join cities on weather.city = cities.name; 
    city  | temp_lo | temp_hi | prcp | date |  name  | location 
---------------+---------+---------+------+------------+---------------+----------- 
San Francisco |  46 |  50 | 0.25 | 1994-11-27 | San Francisco | (-194,53) 
San Francisco |  43 |  57 | 0 | 1994-11-29 | San Francisco | (-194,53) 
Hayward  |  37 |  54 |  | 1994-11-29 |    | 
       |   |   |  |   | Graz   | (90,-90) 

答えて

2

それを見つけた:

SELECT COALESCE(city, name) AS city_name ...