Revert "Revert "SOFT-38 sql changelog, sql query fixed""

This reverts commit 26aed63d1f14d58285ba26abafebf6a0df87c0b5.