Want to get list of email Ids directly from database

Hey all!! i want to ask that till now i am sending alerts on a static mail provided by us in Contact points, but now i have to send alerts on those emails which are linked to the particular org.
Our alert rule was something like if we change spend of a particular org, then after hitting a threshold it must fire an alert to mail linked to that org.
DB used: postgres

Any suggestions?

Change your alert query, so it will return also label (e. g. org) and then create notification policies, which will react only on particular org label values and send them to the right org email contact point.

when i tried this it throws an error which says that the return items must be of type Value or time.

Please provide reproducible example when you are asking. How someone can help you when you describe a problem as “it throws an error”? What is that “it”?

Oh my bad!

	orgs.id as org_id,
    account_details ON orgs.id = account_details.org_id
    account_spend ON account_details.account_id = account_spend.account_id
	roles ON roles.org_id = orgs.id
    account_spend.spend > 900;

this is the query i tried to use in alert rule which then gives an error:

[sse.readDataError] [A] got error: input data must be a wide series but got type not (input refid)

u mean to say that we have to create multiple alert rules and contact points for each of the org.?

Alert query needs also value, so select also account_spend.spend. If org id is a number then cast it as string. Run alert preview and you must see labels (org ig, email) and value in the result.

@jangaraj yeah i tried this way, and it worked. Thanks