Question: I currently have a situation where I have to find the next value after my current move. 

Currently I have below:

```
 SELECT CONVERT(CHAR(17), PlannedStartDateUTC,13) 
 FROM   VisitMovement VM 
 WHERE  vm.VisitMovement_GUID = (SELECT VM2.VisitMovement_GUID 
                                 FROM VisitMovement VM2 
                                 WHERE vm2.OrderIndex = (VisitMovement.OrderIndex +10) 
                                   AND VM2.Visit_GUID = VisitMovement.Visit_GUID )) AS [Estimated Move],

```

Which works by using `VisitMovement.OrderIndex` to find the next move. However, in some situations the `OrderIndex` might not be +10 but +20. 

I can't understand how I would logically write this to find the next move.

Any more information please get in touch.

Answer: 
How have defined the ip of the local server in each node? If you have given the public ip, then the listener would have failed to connect to the port. You must specify 0.0.0.0 for the current node 

```
server.1=0.0.0.0:2888:3888
server.2=192.168.10.10:2888:3888
server.3=192.168.2.1:2888:3888

```

This change must be performed at the other nodes too.
Adding additional info regarding Zookeeper clustering inside Amazon's VPC.
Solution with '0.0.0.0' is working in case of Zookeeper running **directly** inside EC2 instance, in case when you are using docker '0.0.0.0' will not work properly with Zookeeper 3.5.X after node restart.

The issue lies in resolving '0.0.0.0' and ensemble sharing of node addresses and SID order (if you will start your nodes in descending order, this issue may not occur).

So far the only working solution is to upgrade to 3.6.2+ version.