Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在元数据库中设置一个下拉菜单,该菜单中只包含月份值(1月至12月)PostgreSQL_Postgresql_Metabase - Fatal编程技术网

在元数据库中设置一个下拉菜单,该菜单中只包含月份值(1月至12月)PostgreSQL

在元数据库中设置一个下拉菜单,该菜单中只包含月份值(1月至12月)PostgreSQL,postgresql,metabase,Postgresql,Metabase,我目前正在尝试做一个下拉菜单,专门为几个月 下面是我的代码: SELECT avg(Monthly_Calls), district, “Crops”, “Months”, “Date” FROM( SELECT date_part(‘month’, t.created_on::date) as “Months”, COUNT(*) AS Monthly_Calls, t.created_on::date as “Date”, district_name as district, date_p

我目前正在尝试做一个下拉菜单,专门为几个月

下面是我的代码:

SELECT
avg(Monthly_Calls), district, “Crops”, “Months”, “Date”

FROM(
SELECT date_part(‘month’, t.created_on::date) as “Months”,
COUNT(*) AS Monthly_Calls,
t.created_on::date as “Date”,
district_name as district,
date_part(‘year’, t.created_on::date) as “Years”,
t.crop as “Crops”
FROM t
where true
[[and {{Crops}}]]
[[and date_part(‘month’, t.created_on::date) = {{Months}}]]
GROUP BY district_name, date_part(‘month’, t.created_on::date), date_part(‘year’, t.created_on::date), crop, created_on
)calls

where “Years” between 2012 and 2018
GROUP BY district, “Months”, “Crops”, “Date”, “Years”
我只设法以数字值表示月份,我可以将其返回并显示在区域地图中,但我想使月份成为一个下拉列表,就像由1-12的值组成的作物菜单一样(数据库中不提供月份,数据库只创建了一个日期,即2018-09-12)我正在元数据库中使用PostgreSQL数据库

任何帮助都很好谢谢

下面是本月所需输出的屏幕截图