出于纯粹的教育目的,我应该编写什么而不是*
,这样我只能从city_name
或weather.city
获得一列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)
答案 0 :(得分:2)
找到它:
SELECT COALESCE(city, name) AS city_name ...