with ref count in sql