mercredi 25 mars 2015

SQL statement to return grouped nodes


Vote count:

0




I have a table like the one below:



nodelabel | ipaddr | serviceid
x1 | 1.1.1.1 | 1
x1 | 1.1.1.2 | 2
x1 | 1.1.1.3 | 2
x2 | 2.2.2.1 | 1
x2 | 2.2.2.2 | 3
x3 | 3.3.3.1 | 2
x3 | 3.3.3.1 | 3


I am trying to write a sql query which return all nodes where the serviceid != 1 where the resulted table should be like (i.e. this is the desired output)



nodelabel | ipaddr | serviceid
x3 | 1.1.1.1 | 2
x3 | 1.1.1.2 | 3


I have tried many ways to do so but my attempts are just excluding the nodes where the serviceid != 1 and the resulted table would look like:



nodelabel | ipaddr | serviceid
x1 | 1.1.1.2 | 2
x1 | 1.1.1.3 | 2
x2 | 2.2.2.2 | 3
x3 | 3.3.3.1 | 2
x3 | 3.3.3.1 | 3


any thought or help provided is appreciated!


Thank you



asked 51 secs ago

Sinan

129






SQL statement to return grouped nodes

Aucun commentaire:

Enregistrer un commentaire