Я выполняю запрос, который должен возвратить новых пользователей по Month
i.e Количество первичных транзакций, сгруппированных по Phone Number
, по month
& year
.
Вот мой запрос:
select extract(year from timestamp FirstOrderDate) as yr,
extract(month from timestamp FirstOrderDate) as mon,
count(*)
FROM (
SELECT /*The column referred to below is character varying(50) - it is unfortunately not data type date*/
TO_DATE(MIN("Date_Transaction_Occured"),'mm-dd-yyyy') AS FirstOrderDate
FROM "TABLE1"
group by "PhoneNumber"
) AS FirstOrderTable;
group by extract(year from date FirstOrderDate),
extract(month from date FirstOrderDate);
Вот ошибка:
ERROR: syntax error at or near "FirstOrderDate"
LINE 1: ...AS total FROM (select extract(year from timestamp FirstOrder...
^