some sql fixes for new DB structure
Merge branch 'master' of https://github.com/niralittle/Notus