Last active
May 7, 2018 07:43
-
-
Save indigo423/49301465e65367b2ac38b9b8fc21871c to your computer and use it in GitHub Desktop.
OpenNMS View for nodes with categories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE VIEW node_categories AS ( | |
SELECT | |
n.*, | |
COALESCE(s_cat.categoryname, 'no category') AS categoryname | |
FROM | |
node n | |
LEFT JOIN | |
category_node cn | |
ON | |
n.nodeid = cn.nodeid | |
LEFT JOIN | |
categories s_cat | |
ON | |
cn.categoryid = s_cat.categoryid | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment