Improve sql query to be possible get the avaibility with many nodes in the same query