Related resources for having clause in sql