Hello everyone, I was trying to create an advanced SQL variable that involves two tables.
Is this possible?
I've tried in two ways, an inner join and a nested select. None of them works, but what's more strange is that in the test Email, I get the FULL code of the slq variable, and not an error or something like that.
The Idea was to get the time of the last event for a node (subsequently I would have done the same thing for an application) based on the status in which the node is when the mail is sent.. i.e. node back up -> get the date of the last UP event, for that node:
${SQL:select distinct events.eventtime from events inner join eventtypes on events.eventtype = eventtypes.eventtype where eventtypes.name='Node $@Node.Status@' AND events.networknode = '$@Node.NodeID@' order by events.eventtime desc}
or
${SQL:select distinct e.eventtime from events e where e.networknode = '$@Node.NodeID@' and e.eventtype in (select t.eventtype from eventtypes t where t.name='Node $@Node.Status@') order by e.eventtime desc}
The equivalent code of both the queries works within the db manager, obviously without the variables coming from the alert but with explicit node.ID and node.Status.
Has anyone ever tried something like this with success and can help me indicating where I am doing something wrong?
Thank you.
Dave