Working sql before ORM attempt