adding sql query for tags and resources