WITH ranked_alarms AS (
SELECT
"machine_name",
"alarm_message",
COUNT() AS "count",
ROW_NUMBER() OVER (PARTITION BY "machine_name" ORDER BY COUNT() DESC) AS rank
FROM
public.component_trasaction -- Removed double quotes around the table name
WHERE
"alarm_message" IS NOT NULL
AND "alarm_message" <> 'No Alarm'
AND "alarm_message" <> ''
AND "alarm_message" <> 'No alarm'
GROUP BY
"machine_name",
"alarm_message"
)
SELECT
"machine_name",
"alarm_message",
"count"
FROM
ranked_alarms
WHERE
TRUE
[[AND {{machine_name}}]]
AND rank = 1
ORDER BY
"count" DESC;
when i tried to do this. i got this error
ERROR: missing FROM-clause entry for table "component_trasaction" Position: 704