ERROR: missing FROM-clause entry for table

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

Hey there, just guessing,

component_trasaction should not be component_transaction?

So a missing n

no no component_trasaction is correct :sweat_smile:

Might it be related to the way your DB handles the need of " or the schema prefix?

I think its because of alias

rank might be indeed a not allowed keyword