raw sql solution for node.js