Re: UNION not working... why?
От | Stefan Schwarzer |
---|---|
Тема | Re: UNION not working... why? |
Дата | |
Msg-id | 200443F5-5BCE-47CA-976A-2EFFCB8D60BD@grid.unep.ch обсуждение исходный текст |
Ответ на | Re: UNION not working... why? ("Pavel Stehule" <pavel.stehule@gmail.com>) |
Ответы |
Re: UNION not working... why?
|
Список | pgsql-general |
Oh great. Thanks a lot. But now, I have another problem in this context. If I use text in the SELECT statement (so, that the final output gives me the name of the selected variables, plus the year and the value) than I get this error message: ERROR: failed to find conversion function from "unknown" to text If I just use one of the SELECTs, it works fine. But as soon as I use the UNION ALL and add the second SELECT, the error message appears. What am I doing wrong? Thanks for any hints! > SELECT * > FROM (SELECT 'pop_density' AS name, d.year_start, d.value > FROM emissions_so2_total_rivm AS d > LEFT JOIN > countries AS c ON c.id = d.id_country > WHERE ((c.iso_2_code = 'CH') OR (c.iso_3_code = > 'CH')) > ORDER BY d.year_start DESC > LIMIT 1) c1 > UNION ALL > SELECT * > FROM (SELECT 'gdp' AS name, d.year_start, d.value > FROM emissions_so2_total_rivm AS d > LEFT JOIN > countries AS c ON c.id = d.id_country > WHERE ((c.iso_2_code = 'CH') OR (c.iso_3_code = > 'CH')) > ORDER BY d.year_start DESC > LIMIT 1) c2
В списке pgsql-general по дате отправления: