newrelic – Only single subquery results, such as `count(*)`, are allowed in this context

I’m trying to write the following query:

MetricA is not present in Metric
EventA count is present in CustomEvent I came up with the following query:

SELECT 
    filter(count(newrelic.timeslice.value), WHERE appName LIKE 'AppName' AND metricTimesliceName LIKE 'Custom/AppName/name/%/0/MetricA') AS `UpCount` 
FROM Metric FACET metricTimesliceName
WHERE `UpCount` < 1 
AND metricTimesliceName = ( 
    SELECT concat('Custom/AppName/name/', EventA, '/0/MetricA') AS `CustomName`
    FROM CustomEvents 
    WHERE appName="AppName"
    AND EventA IS NOT NULL)

I get the following error: “Only single subquery results, such as count(*), are allowed in this context.”

How I can make the subquery return a single result? The subquery can return multiple results I’m trying to use a cross of metric/event to write a query I can use in an alert

Read more here: Source link