1 ----------- ERROR : ------------
ERROR: SELECT DISTINCT t.year_start
FROM
uneplive_replica.data AS d
JOIN uneplive_replica.time_id AS t ON d."time_ID" = t.time_id
WHERE
d."Indicator_ID" = mpx_7
ORDER BY
t.year_start
|
1 ----------- ERROR : ------------
ERROR: SELECT DISTINCT t.year_start
FROM
uneplive_replica.data AS d
JOIN uneplive_replica.time_id AS t ON d."time_ID" = t.time_id
WHERE
d."Indicator_ID" = mpx_7
ORDER BY
t.year_start
---|
|
1 ----------- ERROR : ------------
ERROR: SELECT * FROM
(
SELECT
cn.country_id,
cn.country_name,
cn.un_region,
'0' AS "region"
FROM
uneplive_replica.country AS cn
WHERE
cn.country_id = 1
ORDER BY
cn.country_name ASC
) c
LEFT JOIN
(
SELECT
a.country_id,
a.data_value,
t.year_start
FROM
uneplive_replica.agg_data AS a
JOIN
uneplive_replica.time_id AS t ON a."time_ID" = t.time_id
WHERE
a."Indicator_ID" = mpx_7
) d ON c.country_id = d.country_id
UNION ALL
SELECT * FROM
(
SELECT
cn.country_id,
cn.country_name,
cn.un_region,
'1' AS "region"
FROM
uneplive_replica.country AS cn
WHERE
cn.country_id = 2 OR country_id = 150 OR cn.country_id = 920 OR cn.country_id = 21 OR cn.country_id = 145 OR cn.country_id = 1741900
ORDER BY
cn.country_name ASC
) c
LEFT JOIN
(
SELECT
a.country_id,
a.data_value,
t.year_start
FROM
uneplive_replica.agg_data AS a
JOIN
uneplive_replica.time_id AS t ON a."time_ID" = t.time_id
WHERE
a."Indicator_ID" = mpx_7
) d ON c.country_id = d.country_id
UNION ALL
SELECT * FROM
(
SELECT
cn.country_id,
cn.country_name,
cn.un_region,
'2' AS "region"
FROM
uneplive_replica.country AS cn
WHERE
country_id = 53 OR country_id = 29 OR country_id = 13 OR country_id = 143 OR country_id = 62 OR country_id = 14 OR
country_id = 30 OR country_id = 753 OR country_id = 151 OR country_id = 54 OR country_id = 57 OR country_id = 17 OR
country_id = 21 OR country_id = 15 OR country_id = 154 OR country_id = 9 OR country_id = 543 OR country_id = 61 OR
country_id = 5 OR country_id = 35 OR country_id = 18 OR country_id = 34 OR country_id = 39 OR country_id = 11 OR
country_id = 145 OR country_id = 747 OR country_id = 155
ORDER BY
cn.country_name ASC
) c
LEFT JOIN
(
SELECT
a.country_id,
a.data_value,
t.year_start
FROM
uneplive_replica.agg_data AS a
JOIN
uneplive_replica.time_id AS t ON a."time_ID" = t.time_id
WHERE
a."Indicator_ID" = mpx_7
) d ON c.country_id = d.country_id
UNION ALL
SELECT * FROM
(
SELECT
cn.country_id,
cn.country_name,
cn.un_region,
'3' AS "region"
FROM
uneplive_replica.country AS cn
WHERE
country_id = 800000 OR country_id = 800001 OR country_id = 199 OR country_id = 722 OR country_id = 1720200 OR country_id = 500000
ORDER BY
cn.country_name ASC
) c
LEFT JOIN
(
SELECT
a.country_id,
a.data_value,
t.year_start
FROM
uneplive_replica.agg_data AS a
JOIN
uneplive_replica.time_id AS t ON a."time_ID" = t.time_id
WHERE
a."Indicator_ID" = mpx_7
) d ON c.country_id = d.country_id
UNION ALL
SELECT * FROM
(
SELECT
cn.country_id,
cn.country_name,
cn.un_region,
'4' AS "region"
FROM
uneplive_replica.country AS cn
WHERE
un_member = 1
ORDER BY
cn.country_name ASC
) c
LEFT JOIN
(
SELECT
d.country_id,
d.data_value,
t.year_start
FROM
uneplive_replica."data" AS d
JOIN
uneplive_replica.time_id AS t ON d."time_ID" = t.time_id
WHERE
d."Indicator_ID" = mpx_7
) d ON c.country_id = d.country_id
ORDER BY
region ASC, un_region ASC, country_name ASC, year_start ASC