I have a table containing some names and associated identifiers, as well as a snapshot:
snapshot, systemid, name[, some, other, columns]
I need to identify all the unique ones namethat a systemidhad in all snapshots, but only where there was at least one change.
For example, with data:
'DR1', 0, 'MOUSE_SPEED'
'DR1', 1, 'MOUSE_POS'
'DV8', 0, 'MOUSE_BUTTONS'
'DV8', 1, 'MOUSE_POS'
'DR6', 0, 'MOUSE_BUTTONS'
'DR6', 1, 'MOUSE_POS'
'PP2', 0, 'MOUSE_SPEED'
'PP2', 1, 'MOUSE_POS'
... I need a query that will return (in any order):
0, 'MOUSE_SPEED'
0, 'MOUSE_BUTTONS'
In addition, it would be useful to have a reverse - a list systemidthat remained stable in everything snapshot (that is, when it namenever changed).
I am using PostgreSQL v8.4.2.
EDIT: Updated to reflect comments (sorry for the original post, other than perfect, I'm new here!).